Ruby on Rails Tuesday, June 5, 2012

Jeremy W. wrote in post #1063195:
> On 5 Jun 2012, at 18:58, "cyber c." <lists@ruby-forum.com> wrote:
>
>> for file in @files
>> @paths = A.fill_paths
>> for path in @paths
>> puts path.a
>> end
>>
>> I cant access path.a, which says
>> "undefined method 'a' for{"a"=>value1,"b"=>value2}:Hash
>> //value1, value2 are valid data
>>
>
> path['a'] is the correct syntax for accessing hashes.

Yah i get it. I wanted to convert this array of hash into an array of
class objects. How do i do that in ruby?

--
Posted via http://www.ruby-forum.com/.

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment