Reputation: 1120
I'm using the partial "infowindow" (app/view/tech/_infowindow.html.erb) to populate a google map marker using:
new_marker = GMarker.new([t.lat, t.lng], :icon => icon, :title => t.summary, :info_window => (render_to_string :partial => "infowindow", :object => t))
but i'm getting a very odd error. When I simply put:
<%= debug(infowindow) %>
I get the full output of the hash. But when I try to reference any of the individual attributes like:
<%= infowindow.summary %>
I get thrown an undefined method `summary' for nil:NilClass even though the attribute shows up in the debug output for the entire hash. Why can I only access the entire hash and not its individual attributes in the partial?
EDIT: The top part of the returned hash:
!ruby/object:Ticket
attributes:
The model being used is a Ticket object if that helps.
Upvotes: 0
Views: 180
Reputation: 14913
What you are trying to do is call the method summary
on the infowindow hash which does not exist in the Hash Class and hence the error. To access individual hash elements try this
<%= infowindow["summary"] %>
Upvotes: 2