blog comments 0 del.icio.us bookmarks 0 diggs 0 Google results 0

6.4
PostRank

count vs length vs size

has_many :through - home From has_many :through - home, 9 months ago, 2 views

In Ruby, #length and #size are synonyms and both do the same thing: they tell you how many elements are in an array or hash. Technically #length is the method and #size is an alias to it.

In ActiveRecord, there are several ways to find out how many records are in an association, and there are some subtle differences in how they work.

That's I always have to look up these differences, so now I have them in one place so I don't have to think about it anymore.

By the way, today is my blog's second birthday. I just couldn't let that go by without a post!

comments

No comments yet.

You must be logged in to add your own comment.