Forum: Ruby on Rails Dry way to validate custom form fields

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
MartOn (Guest)
on 2007-01-19 17:30
(Received via mailing list)
I have a controller where I`m implementing a batch/bulk create action
so I can create bulks of items to a model.
The controller have a create_range function where the form sends params
like this:


Is there a simple way to add ActiveRecord kind of validation on them?
For instance the text_field for range_count_from, would like to
validate as a positive Integer.

what is the DRY`est way of doing this.. I would like to have as few If
<statements> as possible..
What is the Rails way of doing this? Should it be handled in controller
or model?

MartOn (Guest)
on 2007-01-21 01:38
(Received via mailing list)
Nobody with a good example for me?
This topic is locked and can not be replied to.