<% @pays.each do |pay| %>
Is giving me an exception:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.each
I''m lost , pay is the model. Any idead why I''d be getting
this error.
<select name="Pay[id]" id="Pay[id]">
<option value="">Pay Types</option>
<% @pays.each do |x| %>
<option value="<%= pay.id %>">
<%= pay.name %>
</option>
<% end %>
</select>
Stuart
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Hello again :)
Urm, okay, stupid question time (first of many no doubt ;) but..
where are you declaring/instantiating/vivifying @pays ? show the
controller code where you are, as well as the wrapping ''lines''
(maybe an
error with your reseting it or.. something equally crazy :)
Regards
Stef
Dark Ambient wrote:> <% @pays.each do |pay| %>
>
> Is giving me an exception:
>
> You have a nil object when you didn''t expect it!
> You might have expected an instance of Array.
> The error occured while evaluating nil.each
>
> I''m lost , pay is the model. Any idead why I''d be
getting this error.
>
> <select name="Pay[id]" id="Pay[id]">
> <option value="">Pay Types</option>
> <% @pays.each do |x| %>
> <option value="<%= pay.id %>">
> <%= pay.name %>
> </option>
> <% end %>
> </select>
>
> Stuart
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
Can you show us the code that assigns to @pays? Notice that it says nil.each, that tells us @pays is nil not each ''pay'' record because you only ever call their id and name attributes. You''re also use ''x'' as your element name, yet trying to reference ''pay'' -- typo? On 10/09/06, Dark Ambient <sambient-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Is giving me an exception: > > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.each > > I''m lost , pay is the model. Any idead why I''d be getting this error. > > <select name="Pay[id]" id="Pay[id]"> > <option value="">Pay Types</option> > <% @pays.each do |x| %> > <option value="<%= pay.id %>"> > <%= pay.name %> > </option> > <% end %> > </select> > > Stuart > > > >--~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---