Permalink
Browse files

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
  • Loading branch information...
1 parent 8537d5e commit 3e5a8809873526c5761c1a0d7df6535602fd3f61 @dhh dhh committed Dec 20, 2004
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/base.rb
@@ -734,6 +734,10 @@ def id
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 @@ def interpolate_sql(sql, record = nil)
# 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

0 comments on commit 3e5a880

Please sign in to comment.