Hi Jeremy, thanks for the help. I ended up overriding create in that model class to do the defaulting (and then chaining to super once done). -Lorrin
On Jul 29, 2:35 pm, Jeremy Evans <[email protected]> wrote: > On Jul 29, 12:30 pm, Lorrin Nelson <[email protected]> wrote: > > > I've got a non-nullable column and a before_create hook that sets a > > (dynamically computed) default value if none was supplied. > > > I'm bumping into problems because the create() method in base.rb > > set()'s all the values, which typecast_value()'s them, which in turn > > raises an error because the non-nullable column is being set to null > > -- all this happens before the before_create hook gets invoked. > > > I imagine I could work around this by setting typecast_on_assignment = > > false or running my business logic on the hash of incoming values > > before passing it to create. But I'm wondering if there's a more > > idiomatic-Sequel approach to computing default values that I'm > > missing? > > You probably want raise_on_typecast_failure = false. > > 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.
