Forum: Ruby on Rails composed_of Validation - this is a joke right?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jferg (Guest)
on 2009-04-04 18:18
(Received via mailing list)
I just read
http://www.stephenchu.com/2008/05/rails-composedof...
article... twice.  He does a great job, but what I find really ugly
(so not Rails) is when I want to use ActiveRecord:Validations module
in my Value Object - I need to "stub out" some of the inner plumbing
to pretend I am really an ActiveRecord object.

Is this the best way to integrate Value Objects from aggregations into
Rails validation and error reporting?  My googling so far turns up
more questions than answers.

The docs such as:
http://api.rubyonrails.org/classes/ActiveRecord/Ag...
talk about a lot but not about validation.

Please show me there is a more elegant, DRY, declarative way to
realize this than lots of custom code or the module inclusion pattern
written up by Steve C..

Thanks...
Jferg (Guest)
on 2009-04-05 01:52
(Received via mailing list)
Work around - validate the component fields as they exist in the
containing class.  In some cases this is better for my needs - but in
other cases it may be not as useful.

It fits the way Rails works and for now is the best I can do.
This topic is locked and can not be replied to.