Okay, This issue is bugging me for weeks now and I do not know how to get around it properly. Basically I have a database with a table called users, which is a view on top of another users table in a different database. The view has all columns, a primary key assigned and indeces. I have a table called user_additionals which is again a view from another DB, again with primary key assigned and indeces.
When I create the following code: Class User < Sequel::Model one_to_one :user_additional, key => :id End Class UserAdditional < Sequel::Model One_to_one :user, key => :id End This returns with the following error, every time I try to access the association : id is a restricted primary key I have added the "unrestrict_primary_key" option, manually set the primary keys, reset these settings when switching database connections and I keep getting the damm error on every call. The code in question is this: user = User.find id: xxxx user.user_additional.secret = some_value user.user_additional.save Below is a complete stack trace of the call failing on our web servers: "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:1754:in `block in set_restricted'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:1746:in `each'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:1746:in `set_restricted'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:1257:in `set'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:1715:in `initialize_set'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:899:in `initialize'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:163:in `new'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sequel-3.40.0/lib/sequel/model/base.rb:163:in `create'", "/usr/home/morn/billing/releases/20121120192000/lib/user.rb:61:in `secret='", "/usr/home/morn/billing/releases/20121120192000/lib/user.rb:45:in `generate_new_secret!'", "/usr/home/morn/billing/releases/20121120192000/lib/talkers/billcrux_talker.rb:68:in `register_user'", "/usr/home/morn/billing/releases/20121120192000/routes/live_gamer/register.rb:14:in `block in <class:Application>'", "/home/morn/billing/shared/bundle/ruby/1.9.1/gems/sinatra-1.3.3/lib/sinatra/base.rb:1265:in `call'", -- You received this message because you are subscribed to the Google Groups "sequel-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/sequel-talk?hl=en.
