samedi 11 avril 2015

Rails - Pointing form to controller action

I have a simple controller "Users" which has a show action (for each user). Now, I want to have a textbox on the home page which allows to search for a specific user by username.


So on show action, I accept a username param and I respond with the user object. I've seen form_for() but it seems I need an instance of @user which I don't quite understand, since I am only just retrieving on the next request. I've seen tutorials but they seem to have it under index controller action but I really want it to point to users#show so it will use the assets, template, url path, etc.


So I want a form that would just perform a get request with /users/. Am I just missing something simple?


Aucun commentaire:

Enregistrer un commentaire