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 object.save  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
accomplish.

On Jun 2, 10:09 am, Joshua Partogi <joshua.part...@gmail.com> wrote:
> 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,
> Joshua
>
> --http://twitter.com/scrum8

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to