I am trying to use http://compositekeys.rubyforge.org/ in order to have composite primary keys in my activerecord models.
I already added gem 'composite_primary_keys', '=3.1.0'
to my Gemfile.
Now I am trying to setup my first modelclass as follows.
class StringProperty < ActiveRecord::Base
self.primary_keys :entity_id, :property_id
set_table_name "problem.string_property"
attr_accessible :entity_id, :property_id, :value
end
But all I get is:
What am I doing wrong? :(
The following will work I think.
require 'composite_primary_keys'
class StringProperty < ActiveRecord::Base
self.primary_keys = :entity_id, :property_id
set_table_name "problem.string_property"
attr_accessible :entity_id, :property_id, :value
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With