When I run this line of code in my view,
<%= image_tag(item.picture.url(:medium), :class => "iteminfo") %>
I get a
undefined method `symbolize_keys'
error. I’m currently using the paperclip gem with S3 storage. Any suggestions?
— Edit:
Here is what the server log says:
Started GET "/items/compare" for 127.0.0.1 at 2012-01-19 14:47:21 -0500
Processing by ItemsController#compare as HTML
(0.1ms) SELECT items.id FROM "items"
Item Load (0.2ms) SELECT "items".* FROM "items" WHERE "items"."id" IN (3, 2)
Rendered items/compare.html.erb within layouts/application (37.3ms)
Completed 500 Internal Server Error in 99ms
ActionView::Template::Error (undefined method `symbolize_keys' for #<String:0x007f9ebccd92b0>):
3: <% @items.each do |item| %>
4: <div class="item<%= loopcount %>">
5: <% loopcount = loopcount +1%>
6: <%= image_tag(item.picture.url(:medium), :class => "iteminfo") %> <blockquote> </blockquote>
7: <h2 class = "iteminfotext"><%= item.votes %></h2>
8: <h1 class = "iteminfotext"><%= item.location %></h1>
9: <div class="iteminfotext"><%= button_to "Vote", :action => "vote", :id => item.id, %></div>
app/views/items/compare.html.erb:6:in `block in _ app_views_items_compare_html_erb___818922328118740053_70159882605160'
app/views/items/compare.html.erb:3:in `each'
app/views/items/compare.html.erb:3:in ` _app_views_items_compare_html_erb___818922328118740053_70159882605160'
Rendered /Users/Alex/.rvm/gems/ruby-1.9.2-p290/gems/actionpack- 3.1.3/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.1ms)
Rendered /Users/Alex/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (0.8ms)
Rendered /Users/Alex/.rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.3/lib/action_dispatch/middleware/templates/rescues/template_error.erb within rescues/layout (3.8ms)
This is kind of a rails or paperclip issue. If you do
it would not work unless you change it to a link like
else you would always be getting the
to avoid this, all you have to do is reconstruct your image tag block to look like this
or
then your problem is solved
update: