On 6 August 2012 14:13, Steve Morrissey <[email protected]> wrote: > Colin Law wrote in post #1071405: >> On 5 August 2012 22:24, Steve Morrissey <[email protected]> wrote: >>> <%= render @comments %> >>> commented <%= time_ago_in_words comment.created_at %></span> >>> >>> 15 LIMIT 1 >>> CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 14 >>> LIMIT 1 >>> Rendered comments/_comment.html.erb (27.5ms) >>> Rendered snippets/show.html.erb within layouts/application (172.9ms) >>> Completed 500 Internal Server Error in 21602ms >>> >>> ActionView::Template::Error (undefined method `email' for nil:NilClass): >>> 1: <div class="comment_container"> >> >> Put some debug in here to display (or log) comment.inspect (see the >> Rails Guide on debugging), and also comment.user.inspect unless >> comment.user is nil. >> >> Colin > > Thanks for the continued replies, Colin. > > <%= comment.inspect %> gave me: > > #<Comment id: 1, content: "This is a test comment", user_id: 14, > snippet_id: 4, created_at: "2012-08-03 18:01:54", updated_at: > "2012-08-03 18:01:54"> > > And <%= comment.user.inspect %> gave me: > > #<User id: 14, name: "Steve Morrissey", email: "[email protected]", > username: "uberamd", isadmin: nil, isbanned: nil, created_at: > "2012-08-01 19:59:27", updated_at: "2012-08-02 19:39:18", > password_digest: > "$2a$10$nLyWoNjW3/7asFRYsfSKh.yEn824BVcoX2S6erXR3QxV...", > remember_token: > "73iKpBFDCXc4Imq46iABh7RUkG9n8M1HZR9c26b8AIZiFMgAZlt..."> > > So it appears, from my side of the table, that things are in order, > though clearly I'm missing something important. It looks, to me, like > comment.user has all the required info to display the gravatar_for image > (it just requires an email address) as well as comment.user.username and > comment.created_at. But alas, I am clearly wrong as it doesn't work.
Where are you getting gravatar_for from? Perhaps you are using a gem that is not compatible with your version of rails. 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 https://groups.google.com/groups/opt_out.

