The problem is that 2007 and ''2007'' are not valid method
names.
Try p.attributes["2007"] or p["2007"].
Chris
On Apr 8, 7:08 pm, "bitterbal"
<por...-kFg6fFbE636XDw4h08c5KA@public.gmane.org>
wrote:> How do I retrieve the valye if my hash key is a number.
>
> example: record from activerecord query
>
> #<Mutation:0x33cefbc @attributes={"2003"=>"0.00",
"2004"=>"7281.62",
> "week"=>"01",
"2005"=>"11847.90",
"2006"=>"17813.10",
> "2007"=>"27772.45"}>
>
> This is storied in variable "p".
>
> What I want to do is to get the value for p.2007 but ofcourse this
> does not work. I tried p.''2007'' but that also does not
work.
>
> am I trying to do something impossible ?
--~--~---------~--~----~------------~-------~--~----~
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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---