On Apr 20, 4:42 pm, Fearless Fool <[email protected]> wrote:
> My error in terminology -- it's not a join table, but rather a "fact"
> table in the Dimensional Database sense. Would it be any different if
> this was a HABTM table?
>
> Frederick Cheung wrote:
> > ...If you're going do be
> > doing foo.save! (or foo.update_attributes which calls save) then you
> > need a primary key, it's just how active record works
>
> Fred, with all respect, I can't accept your assertion at face value:
> I've made thousands of calls to foo.update_attributes on this table, and
> only this particular update has triggered the error. There must be
> something else going on.
>
I wouldn't expect you to. Read the source:
activerecord/lib/base.rb
def update(attribute_names = @attributes.keys)
quoted_attributes = attributes_with_quotes(false, false,
attribute_names)
return 0 if quoted_attributes.empty?
connection.update(
"UPDATE #{self.class.quoted_table_name} " +
"SET #{quoted_comma_pair_list(connection, quoted_attributes)} " +
"WHERE #{connection.quote_column_name(self.class.primary_key)} =
#{quote_value(id)}",
"#{self.class.name} Update"
)
end
> - ff
>
> --
> Posted viahttp://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group
> athttp://groups.google.com/group/rubyonrails-talk?hl=en.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.