Updated:
Problem resolved
I just needed to put protect_from_forgery in the Users controller. Thanks to everyone.
Rails 4.0.2
When I try to create a new entry in the Users table, I get this message in the browser:
ActionController::InvalidAuthenticityToken in UsersController#create ActionController::InvalidAuthenticityToken
But this happens in the Chrome (32.0.1700.107) and Opera (12.16) browsers. In Firefox (27.0.1) and IE 10.0.13 everything works fine. It may not matter, but I have to say that I also use has_secure_password (bcrypt_ruby).
Rails Magazine:
... Started POST "/users" for 127.0.0.1 at 2014-02-19 10:26:05 +0400 Processing by UsersController#create as HTML Parameters: {"utf8"=>"β", "authenticity_token"=>"93jpgxCSY3XzZkIJKraOodyObBoaPoPMVz3RiOVBL10=", "user"=>{"name"=>"", "surname"=>"", "patronymic"=>"", "email"=>"", "address"=>"", "phone"=>"", "phone2"=>"", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>" "} Can't verify CSRF token authenticity Completed 422 Unprocessable Entity in 2ms ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken): actionpack (4.0.2) lib/action_controller/metal/request_forgery_protection.rb:163:in `handle_unverified_request' actionpack (4.0.2) lib/action_controller/metal/request_forgery_protection.rb:170:in `handle_unverified_request' actionpack (4.0.2) lib/action_controller/metal/request_forgery_protection.rb:177:in `verify_authenticity_token' ...
View the users/new.html.slim :
= stylesheet_link_tag 'users' .new_user_container = form_for @user do |f| = f.label "" br = f.text_field :name br = f.label "" br = f.text_field :surname br = f.label "" br = f.text_field :patronymic br = f.label "" br = f.text_field :password br = f.label " " br = f.text_field :password_confirmation br br = f.submit " "
ruby ruby-on-rails ruby-on-rails-4 actionview
Elcoyote
source share