送信時にこのエラーが発生しますが、わかりません。パラメータが正しく送信されるため
アプリケーションコントローラー
class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
before_filter :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.for(:sign_up) { |u| u.permit! }
end
ユーザー.rb
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable, :confirmable, :omniauthable
validates :role, inclusion: { in: ['player', 'team', 'fan'], message: "%{value} can be player, fan or team!" }
登録ページ
<div><%= f.label :role %><br />
<%= f.select :role, ['fan', 'player'].map{|r| [t(r), r]} %>
<%= f.submit "Sign up" %>
登録ページ(生成)
<select id="user_role" name="user[role]"><option value="fan">Fan</option>
<option value="player">Pro Player</option></select>
サーバーログ
Started POST "/en/users" for 127.0.0.1 at 2013-07-10 23:47:35 +0200
Processing by Devise::RegistrationsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"6conUxB8E4y4Fy2pQ8WrT7ss/ykFqnuYzgoOkQIuSQY=", "user"=>{"email"=>"napster3000@gmail.com", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]", "role"=>"fan"}, "commit"=>"Sign up", "locale"=>"en"}
Unpermitted parameters: role
WARNING: Can't mass-assign protected attributes for User: email, password, password_confirmation
Gemfile
gem 'protected_attributes'
gem 'devise', "~> 3.0.0.rc", github: 'plataformatec/devise' #, branch: 'rails4'
gem 'responders', github: 'plataformatec/responders'
gem 'inherited_resources', github: 'josevalim/inherited_resources'
gem 'ransack', github: 'ernie/ransack', branch: 'rails-4'
gem 'activeadmin', github: 'gregbell/active_admin', branch: 'rails4'
gem 'formtastic', github: 'justinfrench/formtastic'