diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-15 19:48:03 -0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-15 19:48:03 -0700 |
commit | 8b0262f9535cb9ad2215e5ed672150e2c52cb4b4 (patch) | |
tree | 9d97164499b131be9a1a07b3b2b6a3398e809734 /activerecord | |
parent | d043d6539682f804a696d301b580accfc68f6cce (diff) | |
parent | 2470392e89e3320e0e5d4de4dd73db0fd4a30181 (diff) | |
download | rails-8b0262f9535cb9ad2215e5ed672150e2c52cb4b4.tar.gz rails-8b0262f9535cb9ad2215e5ed672150e2c52cb4b4.tar.bz2 rails-8b0262f9535cb9ad2215e5ed672150e2c52cb4b4.zip |
Merge pull request #573 from smartinez87/attr
Add doc to #attribute_names
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/base.rb | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index cfe6d8d2de..cd16b8d3ca 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -767,6 +767,9 @@ module ActiveRecord #:nodoc: super || (table_exists? && column_names.include?(attribute.to_s.sub(/=$/, ''))) end + # Returns an array of column names as strings if it's not + # an abstract class and table exists. + # Otherwise it returns an empty array. def attribute_names @attribute_names ||= if !abstract_class? && table_exists? column_names |