I am working with Ruby on Rails 2.3.8, and I have a collection that is built from two other collections:
@coll1 = Model1.all @coll2 = Model2.all @coll = @coll1 << @coll2
Now I would like to sort this collection using the created_at attribute in the descendant stream. So, I did the following:
@sorted_coll = @coll.sort {|a,b| b.created_at <=> a.created_at}
And I have the following exception:
undefined method `created_at' for #<Array:0x5c1d440>
eventhought exists for these models.
Can anyone help me out?
ruby ruby-on-rails
Brian roisentul
source share