Imagine you have a Post class, which can have many Comment objects. You want the associated Comments to be ordered by the date they were posted on.
To do this, add a posted_on field, then define your Associations like this:
class Post < <a href="http://wiki.rubyonrails.com/rails/pages/ActiveRecord" class="existingWikiWord">ActiveRecord</a>::Base
has_many :comments, :order => "posted_on"
...
end
For more information see the ActiveRecord documentation for associations documentation
Imagine you have a Post class, which can have many Comment objects. You want the associated Comments to be ordered by the date they were posted on.
To do this, add a posted_on field, then define your Associations like this:
class Post < <a href="http://wiki.rubyonrails.com/rails/pages/ActiveRecord" class="existingWikiWord">ActiveRecord</a>::Base
has_many :comments, :order => "posted_on"
...
end
For more information see the ActiveRecord documentation for associations documentation