Notes posted by carpeliam

RSS feed
September 9, 2010
2 thanks

takes ActiveRecord object as an arg as well

One undocumented feature, you can do this:

person = Person.first
# => returns true

This came in handy for me when I needed to see if something belonged to a particular scope.

scope = "created_rails"
person = Person.find_by_name "dhh"
# => returns true

Obviously this relies on you having a named_scope in your Person model called “created_rails”.