On Aug 27, 4:27 pm, Xavier Lange <[email protected]> wrote:
> Is there a way to set the primary key of a model's instance when using
> new/create?
>
> I would like to do
> Role.new(:user_id => 10, :survey_id => 100)
> [:user_id,:survey_id] is a composite key. It raises "Sequel::Error:
> method user_id= doesn't exist or access is restricted to it".
>
> The work around I have found is to first create the instance then set
> those values one at a time.

Access to the primary key column(s) is restarted by default. Use:

  Role.unrestrict_primary_key

Jeremy
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to