On Thursday, August 8, 2019 at 3:03:47 AM UTC-7, Nick Nope wrote:
>
> Hello there,
>
> I have an n:m table with two primary keys. In my tests I am populating the 
> db manually by creating new rows with the a sequel model's create method. 
> To be able to set primary keys I am unrestricting the model on a class 
> level like 
>
> MyModel.strict_param_setting = false
>
> Setting the primary keys in a create statement 
>
> MyModel
>
> will result in an sql statement which omits the primary key names and 
> values completely resulting in something like: 
>
> Mysql2::Error: Field 'pk_1' doesn't have a default value: INSERT INTO 
> `my_model` (`some_field`) VALUES (50.0)
>
> What am I missing? Thanks!
>

MyModel.unrestrict_primary_key

strict_param_setting = false just ignores invalid/restricted keys instead 
of raising an exception.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/cc2e079b-ae70-40d1-9bbd-d27b592ae7ab%40googlegroups.com.

Reply via email to