Hello,
Is there a way to set an ActiveRecord object to point to a table with a
multi-column primary key?
Thank you,
Brian Takita
Hello,
Is there a way to set an ActiveRecord object to point to a table with a
multi-column primary key?
Thank you,
Brian Takita
I get the impression that the current implementation does not support a
primary key with multiple columns.
Looking at base.rb, the primary_key variable is used in such a way that
a single column name is expected.
Is there a way to set an ActiveRecord object to point to a table with a
multi-column primary key?
Not really, no. Active Record was designed for a single column primary key and that assumption runs pretty deep. AR is not a Data Mapper, so you have to be within a reasonable vicinity of its assumptions to enjoy it.
--
David Heinemeier Hansson
http://www.loudthinking.com -- Broadcasting Brain
http://www.basecamphq.com -- Online project management
http://www.rubyonrails.com -- Web-application framework
This is regarding ActiveRecord 1.10.1
David,
First of all, your Rails framework is well done and has revamped my
interest in Ruby, which has been a very good thing. Thank you.
I was thinking that we can get around this single column key limitation
by adding a incrementing int column with a unique index to the table.
I havn't tried it, but it makes sense that it would work.
Brian
David,
First of all, your Rails framework is well done and has revamped my
interest in Ruby, which has been a very good thing. Thank you.
I was thinking that we can get around this single column key limitation
by adding a incrementing int column with a unique index to the table.
I havn't tried it, but it makes sense that it would work.
Brian