aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-12-20 13:32:09 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-12-20 13:32:09 +0000
commit3e5a8809873526c5761c1a0d7df6535602fd3f61 (patch)
tree3cd80be027276122daa43a6202ba8d74b982321c /activerecord
parent8537d5eb93dae418c5c866b313ca1362990957ca (diff)
downloadrails-3e5a8809873526c5761c1a0d7df6535602fd3f61.tar.gz
rails-3e5a8809873526c5761c1a0d7df6535602fd3f61.tar.bz2
rails-3e5a8809873526c5761c1a0d7df6535602fd3f61.zip
Switched strategy on the id_before_type_cast problem and just did an explicit method so postgresql wouldnt choke on id is null
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@234 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord')
-rwxr-xr-xactiverecord/lib/active_record/base.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 8f011947b3..a7347c4af5 100755
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -734,6 +734,10 @@ module ActiveRecord #:nodoc:
read_attribute(self.class.primary_key)
end
+ def id_before_type_cast
+ read_attribute_before_type_cast(self.class.primary_key)
+ end
+
def quoted_id
quote(id, self.class.columns_hash[self.class.primary_key])
end
@@ -1047,7 +1051,7 @@ module ActiveRecord #:nodoc:
# that instances loaded from the database would.
def attributes_from_column_definition
connection.columns(self.class.table_name, "#{self.class.name} Columns").inject({}) do |attributes, column|
- attributes[column.name] = (column.default unless column.name == self.class.primary_key)
+ attributes[column.name] = column.default unless column.name == self.class.primary_key
attributes
end
end