Created
July 8, 2014 01:57
-
-
Save gangelo/240d7624ba941caccd0e to your computer and use it in GitHub Desktop.
Thinkful Wikiful "/signup" postback routes to "/users"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Description: | |
| When signing up as a new user, in "/signup," the "Create User" button will postback to "/users." Not that big a deal, until the submitted form fails validation, in which case the postback url will be "/users." I don't like going to "/signup," only to see "/users" if my form fails validation. | |
| The following is what I did to remedy this, seems simple, but am not sure if there is a "better" way? Suggestions? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <% | |
| # Note: url: signup_path # in routes.rb => post 'signup', to: 'users#create' | |
| %> | |
| <%= form_for @user, url: signup_path, html:{ role: "form"} do |f| %> | |
| <% | |
| # ... | |
| %> | |
| <% end %> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Rails.application.routes.draw do | |
| # ... | |
| # resources :users | |
| get 'signup', to: 'users#new', as: 'signup' | |
| post 'signup', to: 'users#create' | |
| # ... | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment