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.
:conditions => {:author_name => "josh"}). If you set up a counter cache on the association, #count will return that cached value instead of executing a new query.Comment.create(...) instead of post.comments.create(...)).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!
No comments yet.
You must be logged in to add your own comment.