Skip to content
Tags

Dynamic Finders

March 16, 2011

Dynamic finders can be very interesting. You can find documentation about them over here:

http://api.rubyonrails.org/classes/ActiveRecord/Base.html

One thing I want to point out is that dynamic finder ‘find_by_’ always returns the first record and not all the records that match. This is because ‘find_all_by_’ returns all that match and “find_last_by_’ matches the last entry.

The class of find_all_by_  should be Array.

Advertisements

From → Uncategorized

Leave a Comment

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

%d bloggers like this: