> On 16 May 2014 14:54, Walter Lee Davis <[email protected]> wrote: >>>> controller then just create one specifically for searches. However, >> That is down to how you structure your form tag in that view. This can be as > simple as a hand-coded form (no need for form_for helper here) and > whatever you > called your controller (or however you defined your search route) will > determine > what the actual path is. Something like this: >> >> <form action="/search/results" method="get"> >> <input type="search" name="q"> >> </form> >> >> Now if you have a search_controller.rb with a results method, and you made a > route to hook that up, you should be in business.
Thanks for your answer Walter about the use of 'action' form's option, now I know how to make a new methode I just have to watch how to display only only one element in my view. > In addition to Walter's suggestion, I think, Fab, you are a little > confused about the way that views and controllers work. The form that > Walter suggests is shown in the layout and does not need to come from > any particular controller. It is the action that is invoked when the > user requests the search that goes to a controller. So you could just > as easily put the search action in the articles controller just by > changing the form action to articles/search and providing the > appropriate route to a search action. > > Colin Thanks for your anwser too Colin! I think I wasn't confused about the way that views and controllers work but it's just that I did'nt know we can use 'action:/path' to set the controller's path. -- Posted via http://www.ruby-forum.com/. -- 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 [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/365013a70a0387b22bf1f8d4b89872af%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.

