Skip to content
Browse files

Add doc to #attribute_names

  • Loading branch information...
1 parent d043d65 commit 2470392e89e3320e0e5d4de4dd73db0fd4a30181 @smartinez87 smartinez87 committed
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

0 comments on commit 2470392

Please sign in to comment.
Something went wrong with that request. Please try again.