But it exists...in deed when I try the same param in rails console the object is found.
Taywin wrote: > If you look at the error "undefined method `name' for nil:NilClass," > it tells you that the error is from attempting to call a method 'name' > from nil (NULL) object. I believe Rails would attempt to look for both > method and property; however, it would report as undefined 'method' if > it found nil object. > > In your controller, you are using @story = > Story.find_by_id(params[:id]) to search for a story. When a story with > the incoming ID is not found, it returns and assigns nil to your > @story. In your view, you attempt to display 'name' but it is being > called from a nil object. If you want to prevent from error, check for > nil (and may take a proper action) before your let Rails render the > action. > > Regards, > Taywin -- 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 rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.