I am making a Rails 3.1 application and have a registration form that works fine, but I seem to have changed something to break it. I use twitter bootstrap and twitter_bootstrap_form_for gem. I made some changes related to formatting the form fields, but more importantly, when I submit the registration form to create a new user, the information is displayed in the URL and looks like this:
EDIT: This is happening in recent versions of Chrome and Firefox.
http: // localhost: 3000 / utf8 =% E2% 9C% 93 & authenticity_token = UaKG5Y8fuPul2Klx7e2LtdPLTRepBxDM3Zdy8S% 2F52W4% 3D & user% 5Bemail% 5D = kevinc% 40example.com & user% 5Bpassword% 5D = testing & user% 5Bpassword_confirmation% 5D = testing & commit = Sign + Up?
Here is the code for the form:
<div class="span7">
<h3 class="center" id="more">Sign Up Now!</h3>
<%= twitter_bootstrap_form_for @user do |user| %>
<%= user.email_field :email, :placeholder => 'me@example.com' %>
<%= user.password_field :password %>
<%= user.password_field :password_confirmation, 'Confirm Password' %>
<%= user.actions do %>
<%= user.submit 'Sign Up' %>
<% end %>
<% end %>
</div>
Here is the code for UserController:
class UsersController < ApplicationController
def new
@user = User.new
end
def create
@user = User.new(params[:user])
if @user.save
redirect_to about_path, :notice => "Signed up!"
else
render 'new'
end
end
end
, , , ! !
: : post, form_for
<%= form_for(@user, :method => :post) do |f| %>
<div class="field">
<%= f.label :email %>
<%= f.email_field :email %>
</div>
<div class="field">
<%= f.label :password %>
<%= f.password_field :password %>
</div>
<div class="field">
<%= f.label :password_confirmation %>
<%= f.password_field :password_confirmation %>
</div>
<div class="actions"><%= f.submit "Sign Up" %></div>
<% end %>
, .
.rb:
Auth31::Application.routes.draw do
get "home" => "pages#home"
get "about" => "pages#about"
get "contact" => "pages#contact"
get "help" => "pages#help"
get "login" => "sessions#new", :as => "login"
get "logout" => "sessions#destroy", :as => "logout"
get "signup" => "users#new", :as => "signup"
root :to => "pages#home"
resources :pages
resources :users
resources :sessions
resources :password_resets
end