Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #573 from smartinez87/attr

Add doc to #attribute_names
  • Loading branch information...
commit 8b0262f9535cb9ad2215e5ed672150e2c52cb4b4 2 parents d043d65 + 2470392
@josevalim josevalim authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  activerecord/lib/active_record/base.rb
View
3  activerecord/lib/active_record/base.rb
@@ -767,6 +767,9 @@ def attribute_method?(attribute)
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
Please sign in to comment.
Something went wrong with that request. Please try again.