magpiebrain

Sam Newman's site, a Consultant at ThoughtWorks

In Rails (well, ActiveRecord) you can support simple ordered collections fairly easily. Say I had a Post object, with multiple Comment objects, but I want to keep the Comment objects in order they were posted, where posted_on holds the posted date:


class Post "posted_on"

	

...

end

This has been a post on behalf of the just-letting-you-know-I’m-alive and the I’m-blogging-this-so-I-can-find-it-with-google-later parties.

Advertisements

One Response to “Ordered collections in Ruby On Rails”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS

%d bloggers like this: