On 7 January 2011 17:39, Peter Bell <[email protected]> wrote: > Hi All, > > I'm working with an API that returns me a collection of locations as a hash. > I could just display things like @places[:feature][:name] etc, but that seems > pretty ugly (and brittle) to me.
I don't quite understand what you mean by a collection of locations. Is that an array of hashes? Can you explain the data structure in more detail? > > So I'm tempted to have a non-AR, non-persisted model class called Place. > > If I was writing this in Groovy I'd probably create a static method on Place > - maybe loadPlaces(hash: placeHash) that would return a collection of place > objects. > > What would be the idiomatic Rails/Ruby approach to something like this? Would > I just change the capitalization to have a Place.load_places(place_hash) > method :) or would there be a more Ruby/Rails way of solving the problem? Why are you passing a hash to load_places? Colin -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

