Search form validation

Hello everybody!

I am new to Ruby on rails and so my doubt would be very trivial for the
most of you. But, since I do not know to tackle the problem, I would
like
to ask you.

I have a search method defined in my model. I need to add validations to
the search method.

Should I add a javascript function in my index.html or can I validate
the
method in the model itself?

Note : My search method does not have a model of its own. It is defined
in
another model.

Please help me on this issue.

Any suggestion would be appreciated.

Thanks in advance!

On Jan 27, 2014, at 9:41 AM, spurthi gunadhar wrote:

Please help me on this issue.

Any suggestion would be appreciated.

What sort of validations are you looking to add here? What search
technique are you using, and do you need to protect people from getting
no results if they put garbage in?

Walter

Hi,

I think you can try sing Form Object, see
http://blog.codeclimate.com/blog/2012/10/17/7-ways-to-decompose-fat-activerecord-models/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs