Hi there,
I’m working through Week 2 of this workshop, and I’ve run into this same error with PhotoShouts. I’ve done some Googling on this, and also searched this forum, but so far haven’t been able to solve the issue. The only difference I can see in what I’m doing is that I am using Pow as my web server for development. I’ve tried restarting of course, but that has not helped.
When I first saw the error, I realized that I had not installed Imagemagick. I did that via HomeBrew, and also configured the development.rb as directed in the Paperclip docs. But the problem persists, same error.
All my current code is on GitHub here: https://github.com/joshukraine/intermediate-rails
This is the specific error I’m getting in the browser:
ArgumentError in Dashboards#show
Showing /Users/joshukraine/dev/projects/intermediate-rails/shouter/app/views/shouts/_shout.html.erb where line #4 raised:
'nil' is not an ActiveModel-compatible object that returns a valid partial path.
Extracted source (around line #4):
1: <%= div_for shout do %>
2: <%= link_to shout.user.username, shout.user %>
3: shouted
4: <%= render shout.content %>
5: <%= link_to "#{time_ago_in_words(shout.created_at)} ago", shout %>
6: <% end %>
Also, for what it’s worth, here’s what I’m seeing in the log:
Started GET "/dashboard" for 127.0.0.1 at 2014-05-08 12:23:02 +0300
Processing by DashboardsController#show as HTML
User Load (0.2ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4 LIMIT 1
Shout Load (0.1ms) SELECT "shouts".* FROM "shouts" WHERE "shouts"."user_id" = 4 ORDER BY created_at DESC
CACHE (0.0ms) SELECT "users".* FROM "users" WHERE "users"."id" = 4 LIMIT 1
Rendered shouts/_shout.html.erb (28.3ms)
Rendered dashboards/show.html.erb within layouts/application (49.3ms)
Completed 500 Internal Server Error in 146ms
ActionView::Template::Error ('nil' is not an ActiveModel-compatible object that returns a valid partial path.):
1: <%= div_for shout do %>
2: <%= link_to shout.user.username, shout.user %>
3: shouted
4: <%= render shout.content %>
5: <%= link_to "#{time_ago_in_words(shout.created_at)} ago", shout %>
6: <% end %>
app/views/shouts/_shout.html.erb:4:in `block in _app_views_shouts__shout_html_erb__3727034432027626738_70139996934800'
app/views/shouts/_shout.html.erb:1:in `_app_views_shouts__shout_html_erb__3727034432027626738_70139996934800'
app/views/dashboards/show.html.erb:11:in `_app_views_dashboards_show_html_erb__2638964540940122497_70139997269620'
And lastly from the db:
#<Shout id: 10, user_id: 4, created_at: "2014-05-07 14:35:35", updated_at: "2014-05-07 14:35:35", content_type: "PhotoShout", content_id: nil>
Thanks in advance for any assistance!
Josh