Reputation: 420
I'm trying to hook up a rails 3 app to a legacy mysql database. One of the tables has only two columns: "name" and "id". "name" is the primary key (lucking for me).
I've set the primary key using:
set_primary_key :name
BUT whenever I retrieve the record, it assigns the value of name to both the id and name attributes.
I thought about creating a mysql view, but i need to be able to set id, not just read the value. i tried using alias_attribute to no avail.
any ideas?
Upvotes: 1
Views: 372
Reputation: 10701
You can make updatable views in mysql at least, so that might be an option.
http://dev.mysql.com/doc/refman/5.0/en/view-updatability.html
Upvotes: 1