Rails Search Form

后端 未结 4 680
北海茫月
北海茫月 2021-02-01 00:05

I\'m creating an application that tracks users and achievements (think, xbox live, etc.) These tables are linked via a join table. I would like to have a search form on my inde

4条回答
  •  情书的邮戳
    2021-02-01 00:44

    There are plenty of tutorials and things about this e.g.:

    http://blog.devinterface.com/2010/05/how-to-model-a-custom-search-form-in-rails/

    Look the thing is every basic explanation in Rails3 starting with the Initial Tutorial provided by them explains you how to setup a new Controller/Model. The example was only one of thousands explaining the same problem.

    It is a very broad range of different things you can do to achieve this. Basically you have to put some code in the controller:

    1. which handles the search (including the activerecord stuff or whichever technique you use to access your model)
    2. which sets some variables necessary for the search form

    Setup two routes etc... Its to broad and completely covered even by the basic official rails3 tutorial.

提交回复
热议问题