the error is undefined method `image' for nil:NilClass On Mon, Jun 20, 2011 at 2:42 PM, Colin Law <[email protected]> wrote:
> On 20 June 2011 17:53, joanne ta <[email protected]> wrote: > > I have other undefined method when i combine the code above together > > > > <%@users = User.all%> > > <%@users.each do |u|%> > > <%u.culture_id%> > > > > <% @pic= Picture.where(:phrase_id => :route , :culture_id => > > u.culture_id).first%> > > <td>My picture <%= @pic.image%></td> > > > > and it causes undefined method image > > What does it say has not got a method image? It is always a good idea > to post the complete error message (use copy/paste rather than > re-typing it). If it says the nil has not got the method then your > call of Picture.where has not found a record. > > Colin > > -- > 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. > > -- -------------------------------- Thank you, Yen -- 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.

