Ruby on Rails Wednesday, December 3, 2014

On Tuesday, December 2, 2014 6:16:31 PM UTC, Kareem Gan wrote:
What happens if you have get and post on the same method on a controller?

Would it always be get first then if a user clicks on the submit button becomes post? How do you set certain conditions that only must happen if a user hits the submit button sending a post request?

If your routes file maps get and post for a path to a controller action then it's up to that action do decide whether to handle things differently (e.g. by checking request.method (or the helpers request.post? etc))

Fred

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/6787f114-eea8-4e34-83a1-3605957d8017%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment