Hi ,
I have created an array of hashes using
Model file class
Class A < ActiveRecord::Base
def fill_paths
paths = Array.new
for file in @files
path = {}
path["a"] = file
path["b"] = DATA2(assume data2 is valid)
paths << path
end
return paths
end
in controller class
@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
Please let me know whats wrong with this.
--
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