Mark Preston wrote:
> Frederick Cheung wrote:
>> On Jul 13, 12:38�am, Mark Preston <[email protected]>
>> wrote:
>>> � � � �...@my = �Mystuff.find( :all)
>> This
>>
>>> <h1>Mystuff#index</h1>
>>> <p><%me.each do |mr|%></p>
>>
>> and this need to match - the instance variables are copied over for
>> you.
>>
>> Fred
>
> Fred thanks, I saw that and changed it, but still am getting the error:
>
> You have a nil object when you didn't expect it!
> You might have expected an instance of Array.
> The error occurred while evaluating nil.each
>
> Extracted source (around line #2):
>
> 1: <h1>Mystuff#index</h1>
> 2: <p><%[email protected] do |mr|%></p>
> 3: <h1><%=mr.m1%></h1>
> 4: <% end %>
>
> and I checked the DB, there is definately data in m1
>
> DB
> -----
> id m1
> 1 45
> 2 452
>
> Thanks
I got it to work by changing my method in the mystuff_controller to look
like this:
require 'Mystuff'
class MystuffController < ApplicationController
def index
@my = Mystuff.find( :all)
end
end
The only change was to change the name of the method to "index" Seems
odd
Thanks all
Mark
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---