Mark Preston wrote:
> Frederick Cheung wrote:
>> On Jul 12, 11:47�pm, Mark Preston <[email protected]>
>> wrote:
>>> <h1>Mystuff#index</h1>
>>> <p><%mystuff.each do |mr|%></p>
>>> <h1>mr.m1</h1>
>>> <% end %>
>>>
>> if you want to display the result of a ruby expression (eg one of your
>> attributes) then you need to use <%= ... %> (don't forget to use h to
>> escape nasties (if appropriate))
>>
>> Fred
> 
> When I run the webrick server I get the following error message:
> 
> 
> Showing app/views/mystuff/index.html.erb where line #2 raised:
> 
> undefined local variable or method `mystuff' for 
> #<ActionView::Base:0x388b348>
> 
> Extracted source (around line #2):
> 
> 1: <h1>Mystuff#index</h1>
> 2: <p><%mystuff.each do |mr|%></p>
> 3: <h1>=mr.m1</h1>
> 4: <% end %>
> 
> 
> HELP :)

Ok, in the controller you are assigning @me to your find. Try:

<% @my.each do |mr| %>

in your view instead.

Also, don't forget to enclose that attribute in tags:

<h1><%= mr.m1 %></h1>

HTH

Matt

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to