diff options
author | Marcel Molina <marcel@vernix.org> | 2007-12-05 14:22:26 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2007-12-05 14:22:26 +0000 |
commit | e4d845ef54ff348afc8516c9168654ae6cd327c7 (patch) | |
tree | bdf23b3100ad94e0613e3333cdbead300d963b51 /activerecord/lib | |
parent | 519f2c9d718f53ba6a256d23ed808877dc9e1cf5 (diff) | |
download | rails-e4d845ef54ff348afc8516c9168654ae6cd327c7.tar.gz rails-e4d845ef54ff348afc8516c9168654ae6cd327c7.tar.bz2 rails-e4d845ef54ff348afc8516c9168654ae6cd327c7.zip |
Document automatically generated predicate methods for attributes. Closes #10373 [chuyeow]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8280 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index b67a0d3e69..2d518a1ca1 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -155,6 +155,20 @@ module ActiveRecord #:nodoc: # You can alternatively use self[:attribute]=(value) and self[:attribute] instead of write_attribute(:attribute, value) and # read_attribute(:attribute) as a shorter form. # + # == Attribute query methods + # + # In addition to the basic accessors, query methods are also automatically available on the Active Record object. + # Query methods allow you to test whether an attribute value is present. + # + # For example, an Active Record User with the <tt>name</tt> attribute has a <tt>name?</tt> method that you can call + # to determine whether the user has a name: + # + # user = User.new(:name => "David") + # user.name? # => true + # + # anonymous = User.new(:name => "") + # anonymous.name? # => false + # # == Accessing attributes before they have been typecasted # # Sometimes you want to be able to read the raw attribute data without having the column-determined typecast run its course first. |