Forum: Ruby on Rails Search form validation

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.
46a29cbc2d5cc2e41bd4fde0c8dd4b07?d=identicon&s=25 spurthi gunadhar (Guest)
on 2014-01-27 15:47
(Received via mailing list)
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!
A47e0a6beeb9d048ff054fc1c3a97418?d=identicon&s=25 Walter Davis (walterdavis)
on 2014-01-27 15:50
(Received via mailing list)
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
1a8688b1d13c493617312672facbbf74?d=identicon&s=25 Yong Gu (Guest)
on 2014-01-27 15:51
(Received via mailing list)
Hi,

I think you can try sing Form Object, see
http://blog.codeclimate.com/blog/2012/10/17/7-ways...
This topic is locked and can not be replied to.