So I have a blog like setup for my website. Users can comment on
another person’s blog. I want the comment to include a link to the
author’s profile. This is proving to be problematic.
The blog is a resource and the comments are also a resource, nested in
The profile route is this: map.profile ‘profile/:screen_name’,
:controller => ‘profile’, :action => ‘show’
So if I have a profile by user Steve, it should link to /profile/steve
If Steve leaves a comment on a blog, I want to link to his profile. I
have tried something like <%= link_to comment.user.screen_name,
profile_for(comment.user) %> and variations of it with no success.
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.screen_name