diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-31 17:31:33 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-31 17:31:33 +0000 |
commit | d0360a4d5c024c85ecdd7a4eca72256712c4f9d3 (patch) | |
tree | d1564be1291abaab1deee2fd1f29db348ae00bff /activerecord/lib | |
parent | 8158455ded5811271e7d8530f262bc74a1677334 (diff) | |
download | rails-d0360a4d5c024c85ecdd7a4eca72256712c4f9d3.tar.gz rails-d0360a4d5c024c85ecdd7a4eca72256712c4f9d3.tar.bz2 rails-d0360a4d5c024c85ecdd7a4eca72256712c4f9d3.zip |
Base.inspect handles Base itself and abstract_class? Don't use #<Foo ...> since that notation's typically used for instances of a class, not the class itself. Closes #8490 [deepblue]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6913 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index b838b1cdc0..e1f3dce7ce 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -895,9 +895,16 @@ module ActiveRecord #:nodoc: end end - # Returns a string looking like: #<Post id:integer, title:string, body:text> + # Returns a string like 'Post id:integer, title:string, body:text' def inspect - "#<#{name} #{columns.collect { |c| "#{c.name}: #{c.type}" }.join(", ")}>" + if self == Base + super + elsif abstract_class? + "#{super}(abstract)" + else + attr_list = columns.map { |c| "#{c.name}: #{c.type}" } * ', ' + "#{super}(#{attr_list})" + end end |