Tuesday, May 7, 2013

Re: [Rails] Search and routes

On Tue, May 7, 2013 at 3:38 AM, Paul Bergstrom <lists@ruby-forum.com> wrote:

> How do I define the route for a search form that goes to index
> action, which either lists all, if no search, or the search result?

The route can be just the same as always. The way I've done this sort
of thing is that in the controller, it checks for search params. If
it finds any, it does the search and passes along the result set, else
it passes along all. (Subject to pagination if wanted.)

-Dave

--
Dave Aronson, the T. Rex of Codosaurus LLC,
secret-cleared freelance software developer
available for contracts or temp employment.
See information at http://www.Codosaur.us/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate