Michael Pavling wrote in post #1063197: > On 5 June 2012 19:19, cyber c. <li...@ruby-forum.com> wrote: >> 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? > > They are "class objects" - hashes are instances of Hash class ...
In the index.html.erb file the following code doesnt work, paths contain valid data populated in the controller class. <% @paths.each do |path| %> <tr> <td><%= path.a %></td> -- Since paths is an array of hash path['a'] should work It says undefined method 'a' for {"a"=>".", "b"=>"."}:Hash Changing path.a to path['a'] gives me an error "No route matches {:a=>".", :b=>".", :action=>"edit", :controller=>"file_paths"}" Note: . is a valid data (referring to a path in a dir) -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.