Hello, is there any model-validation library without dependency on
ActiveSupport?
I can't find any.
···
--
Posted via http://www.ruby-forum.com/.
Hello, is there any model-validation library without dependency on
ActiveSupport?
I can't find any.
--
Posted via http://www.ruby-forum.com/.
DataMapper and dm-validations has no dependency on ActiveSupport. I suspect
the minimalist ORM/Model layer is the same, but I don't know if it has any
validations either.
Were you looking for any solution, or an ActiveRecord only solution?
On Wed, Aug 24, 2011 at 11:31 AM, Alexey Petrushin <axyd80@gmail.com> wrote:
Hello, is there any model-validation library without dependency on
ActiveSupport?I can't find any.
--
http://richardconroy.blogspot.com | http://twitter.com/RichardConroy
Thanks.
But it has dependency on the dm-core (DataMapper), so it seems that it
can be used with DataMapper only.
--
Posted via http://www.ruby-forum.com/.
Yes, Sequel[1] supports model validations[2].
[1] http://sequel.rubyforge.org/
[2] http://sequel.rubyforge.org/rdoc/files/doc/validations_rdoc.html
On Aug 24, 2011, at 4:31 AM, Alexey Petrushin wrote:
Hello, is there any model-validation library without dependency on
ActiveSupport?
Model validations by their nature are very intimate with the ORM.
Hmm, I see this from a little different point - validations is nothing
more than a set of DSL and rules to define expectations about Ruby
objects. It has a very little to do with ORM (only: valid?, errors & a
little of sugar-syntax, and even all these methods are ORM agnostic by
their nature).
I forked the 'jnunemaker-validatable' (latest updated version of old
validatable gem) and removed all the ActiveRecord stuff from there,
tests are passed and it seems to work (I pushed it as the validatable2
gem).
The dm-validations is subjected to be used with non datamapper models. It has
support for plain old ruby objects.
The dm-validations is subjected to be used with non datamapper models. It has
support for plain old ruby objects.
Maybe it's applicable also to plain objects, but it still requires
dm-core and it adds unnecessary dependencies and potentially can cause
incompatibilities.
--
Posted via http://www.ruby-forum.com/\.
Model validations by their nature are very intimate with the ORM.
Another approach may be to use something like bureaucrat (an ORM agnostic
form helper) or validations that are at the controller/view level.
It is not DRY, as those validations are not performed in console or through
an API layer, but a lot of the benefit of validations occurs between the
user and the keyboard.
regards,
Richard
On Wed, Aug 24, 2011 at 12:42 PM, Alexey Petrushin <axyd80@gmail.com> wrote:
Thanks.
But it has dependency on the dm-core (DataMapper), so it seems that it
can be used with DataMapper only.
--
http://richardconroy.blogspot.com | http://twitter.com/RichardConroy
The dm-validations is subjected to be used with non datamapper models.
It has support for plain old ruby objects.
For example I am already using it with virtus.
On Wed, Aug 24, 2011 at 09:46:34PM +0900, Richard Conroy wrote:
On Wed, Aug 24, 2011 at 12:42 PM, Alexey Petrushin <axyd80@gmail.com> wrote:
> Thanks.
>
> But it has dependency on the dm-core (DataMapper), so it seems that it
> can be used with DataMapper only.
>
>
Model validations by their nature are very intimate with the ORM.Another approach may be to use something like bureaucrat (an ORM agnostic
form helper) or validations that are at the controller/view level.It is not DRY, as those validations are not performed in console or through
an API layer, but a lot of the benefit of validations occurs between the
user and the keyboard.regards,
Richard--
http://richardconroy.blogspot.com | http://twitter.com/RichardConroy