RoR: Output Hash, getting correct parameters?

Posted by andrewliu on Stack Overflow See other posts from Stack Overflow or by andrewliu
Published on 2013-04-15T07:00:48Z Indexed on 2013/10/27 21:54 UTC
Read the original article Hit count: 206

I have output something like this:

#<Hashie::Mash created_time="1366008641" 
from=#<Hashie::Mash full_name="Cor Valen" id="22340" username="_corin"> 
id="4344344286" text="Look Who It Is, My Brother, My Favorite Deputy">

This was an output if I did this:

<%= media.caption %>

I wanted to get the text part, and I did this:

<%= media.caption.text %> 
gets me error: undefined method `text' for nil:NilClass

<%= media.caption[:text] %>
gets me error: undefined method `[]' for nil:NilClass

I don't get it?

Thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby