diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-21 17:35:09 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2007-04-21 17:35:09 +0000 |
commit | 52a9e5089ce61fa1f07abe3e36af53ae744b3999 (patch) | |
tree | c9e4124839d71aa6c2ceb7f22e5efff5e5320e69 /activerecord/lib | |
parent | 635c7f43ddb4f3f3bd52698fcaf97e262b1738be (diff) | |
download | rails-52a9e5089ce61fa1f07abe3e36af53ae744b3999.tar.gz rails-52a9e5089ce61fa1f07abe3e36af53ae744b3999.tar.bz2 rails-52a9e5089ce61fa1f07abe3e36af53ae744b3999.zip |
Added ActiveRecord::Base.inspect to return a column-view like #<Post id:integer, title:string, body:text> [DHH]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6549 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index aa90e8bcc2..c46e97b1b7 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -862,6 +862,11 @@ module ActiveRecord #:nodoc: end end + # Returns a string looking like: #<Post id:integer, title:string, body:text> + def inspect + "#<#{name} #{columns.collect { |c| "#{c.name}:#{c.type}" }.join(", ")}>" + end + def quote_value(value, column = nil) #:nodoc: connection.quote(value,column) |