aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/CHANGELOG2
-rwxr-xr-xactiverecord/lib/active_record/base.rb5
2 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG
index 2cc7c4c304..b6d009bbb0 100644
--- a/activerecord/CHANGELOG
+++ b/activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added ActiveRecord::Base.inspect to return a column-view like #<Post id:integer, title:string, body:text> [DHH]
+
* Added yielding of Builder instance for ActiveRecord::Base#to_xml calls [DHH]
* Small additions and fixes for ActiveRecord documentation. Closes #7342 [jeremymcanally]
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)