Validating form that is not bounded to Model

Hi all,

I would like to validate a form, but this form is not bounded to a
Model? What would be the best approach to do this in Rails? I tried to
look in the Rails guide with no luck. Can anybody share their
experience please?

Thank you very much in advance.

Kind regards,

You could do it in the controller action the form posts to. Or, if
you want to keep your controller skinny you could possibly create a
model not associated with a database table with validation methods and
call object.valid? from the controller but never call You
could alternately create a new class that would validate the form data
but that may or may not take more work on your part. There are a
number of approaches that might work.

Personally, if the validations would be quick and simple (like
checking the length of a field) then I would do it from the
controller, if I knew I would have to use more than, say, 10 lines, or
the validations are non-trivial, I would use a model/class.

If you need a more specific guidance you should possibly paste the
form and provide additional details as to what you're trying to