diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-18 07:24:03 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2007-05-18 07:24:03 +0000 |
commit | 4d753adeaf623a341daca7f008c66034c69ba7a0 (patch) | |
tree | 68bc58fcca584a87b1cb6476dc04c3577e865f4a /activerecord/lib | |
parent | 83318c7e8ad05131da1f031e3bef19459dca57fa (diff) | |
download | rails-4d753adeaf623a341daca7f008c66034c69ba7a0.tar.gz rails-4d753adeaf623a341daca7f008c66034c69ba7a0.tar.bz2 rails-4d753adeaf623a341daca7f008c66034c69ba7a0.zip |
Pay tribute to timezones. Tune #inspect style.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6766 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 65f808815e..365af0a93e 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -897,7 +897,7 @@ module ActiveRecord #:nodoc: # Returns a string looking like: #<Post id:integer, title:string, body:text> def inspect - "#<#{name} #{columns.collect { |c| "#{c.name}:#{c.type}" }.join(", ")}>" + "#<#{name} #{columns.collect { |c| "#{c.name}: #{c.type}" }.join(", ")}>" end @@ -1817,10 +1817,10 @@ module ActiveRecord #:nodoc: raise "Attribute not present #{attr_name}" unless has_attribute?(attr_name) value = read_attribute(attr_name) - if (value.is_a?(String) && value.length > 50) - '"' + value[0..50] + '..."' - elsif (value.is_a?(Date) || value.is_a?(Time)) - '"' + value.to_s(:db) + '"' + if value.is_a?(String) && value.length > 50 + %("#{value[0..50]}...") + elsif value.is_a?(Date) || value.is_a?(Time) + %("#{value.to_s(:db)}") else value.inspect end @@ -1908,8 +1908,10 @@ module ActiveRecord #:nodoc: # Nice pretty inspect. def inspect - attributes_as_nice_string = self.class.column_names.collect {|attr_name| "#{attr_name}: #{attribute_for_inspect(attr_name)}"}.join(", ") - "#<#{self.class.name} #{attributes_as_nice_string}>" + attributes_as_nice_string = self.class.column_names.collect { |name| + "#{name}: #{attribute_for_inspect(name)}" + }.join(", ") + "#<#{self.class} #{attributes_as_nice_string}>" end private |