Hi Jeremy,

thanks for the quick answer! Then I'll try to unrestrict it for that 
particular model.

p.s. Sequel is very impressive, thanks alot for creating it!

Cheers
Nicky



On Wednesday, July 17, 2019 at 11:13:25 PM UTC+2, Jeremy Evans wrote:
>
> On Wednesday, July 17, 2019 at 12:08:20 PM UTC-7, Nick Nope wrote:
>>
>> Hello there,
>>
>> I have a table (user_verifications) which has a non auto-incrementing 
>> primary key (user_id). The PK is an id referencing another table (users) 
>> via foreign key (user_verifications.user_id -> users.user_id). The idea is 
>> that user_verifications can only contain one value per user in the users 
>> table. As soon as I try to create a record I get the 
>> user_id is a restricted primary key
>> error. I am wondering why it is not possible to make use of identifying 
>> 1:1 relationships with sequel. Anything I am missing?
>>
>> Thanks in advance!
>>
>
> Sequel by default assumes the use of surrogate primary keys and disables 
> mass assignment to the primary key field.  For models that use tables with 
> natural primary keys, you probably want to remove the restriction, which 
> you can do by calling unrestrict_primary_key in the model's class. See 
> http://sequel.jeremyevans.net/rdoc/classes/Sequel/Model/ClassMethods.html#method-i-unrestrict_primary_key
>
> Thanks,
> Jeremy 
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/852f0923-ae6a-49e1-b025-aa232ee4ce4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to