On Jul 12, 10:47 pm, Jeremy Evans <[EMAIL PROTECTED]> wrote:
> On Jul 12, 6:02 am, Glen <[EMAIL PROTECTED]> wrote:
>
> > Out of curiosity, why does Sequel::Model.new use set rather than
> > set_all when from_db is false?  It threw me for a bit trying to figure
> > out why I couldn't set the primary key on a new record through the new
> > method.
>
> The primary key is protected by default.  If you want the primary key
> to be set with new/create/set/update, use Model.unrestrict_primary_key
> to unprotect it.  Sequel should raise an Error if you try to set a
> primary key when it is protected, unless you have
> Model.strict_param_setting = false.
>
> Jeremy

Thanks Jeremy,

That's how I solved it (Model.unrestrict_primary_key).  It just seemed
a bit counter intuitive to me to have the primary_key protected in new
when new wasn't grabbing from the db.  I can understand protecting it
always as a best practice though.
--~--~---------~--~----~------------~-------~--~----~
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