On Mon, Aug 8, 2011 at 4:42 PM, Colin Law <[email protected]> wrote:
> On 8 August 2011 11:40, Sayuj Othayoth <[email protected]> wrote: > > > > > > On Mon, Aug 8, 2011 at 4:06 PM, Colin Law <[email protected]> > wrote: > >> > >> On 8 August 2011 11:17, Sayuj Othayoth <[email protected]> wrote: > >> > [...] > >> > class StatusMessage < ActiveRecord::Base > >> > belongs_to :users > >> > >> That should be :user, singular. > > Did you make this correction as I suggested previously, so it should > be belongs_to :user (each message belongs to one user so singular) > > Colin > Yes I made the changes. Error is "undefined method *`user'* for #<StatusMessage:0xb126384>" > > > When I use s.user.email, it shows: > > > > NoMethodError in Status_message#index > > > > Showing > > /home/sayuj/work/sayuj/microblog/app/views/status_message/index.html.erb > > where line #9 raised: > > > > undefined method `user' for #<StatusMessage:0xb126384> > > > > Extracted source (around line #9): > > > > 6: <% end %> > > 7: <br /> > > 8: <% @status.each do |s| %> > > 9: <%= s.user.email %> > > 10: <%= s.status %> <br /> > > 11: <% end %> > > -- > 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. > > -- 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.

