On Mar 24, 12:21 pm, cult hero <[email protected]> wrote:
> These are valid points. I guess in that case, I need to figure out how
> to get Sequel validations to work in line like AM's would for things
> like forms and such. I'm trying to avoid reinventing the wheel as much
> as possible.
>
> Can the Sequel validations be used with the Rails form helper without
> a lot of special plumbing? (Or does the the AM plugin handle this?) I
> remember there being an option so that validations don't throw an
> exception somewhere. Is that all I need to enable here?

ActiveModel's only requirement is that errors responds to
full_messages, which Sequel's does regularly, even without the
active_model plugin.  Theoretically, this should allow it to work
correctly in Rails.  However, I'm not sure that Sequel::Model::Errors
is perfectly API compatible with what AR uses, I haven't really
looked.

You probably want:

  Sequel::Model.raise_on_save_failure = false

Without that, Sequel will raise an exception if you attempt to save an
invalid object.  With that, save will just return false instead of
raising an exception, similar to how AR handles things.

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