Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
dhh committed Dec 20, 2004
1 parent 8537d5e commit 3e5a880
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/lib/active_record/base.rb
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3e5a880

Please sign in to comment.