On Jul 7, 2:45 am, Philip Silva <[email protected]> wrote: > Hi, > > I am having this model: > > DB = Sequel.sqlite('db/my.db') > class Foo < Sequel::Model(DB) > set_primary_key :id > end > > With an underlying SQLite table: CREATE TABLE foos (id text, name > text, primary key (id) ); > > Now I do: > > Foo.new({:id => "1310031611-712987-77303", :name="abc"}) > > And SQLite tells me: Sequel::Error: method id= doesn't exist or access > is restricted to it (Stack trace:http://pastebin.com/5a24PB3z) > > What am I doing wrong? Are there any tricks?
Philip already figured this out, but for other people who come across this, you need to do: Foo.unrestrict_primary_key if you want to be able to set a primary key field using mass assignment for a Foo model instance. 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.
