I am trying to add a drop down menu of User role in a Rails Application. I have configured the devise gem with default parameters. So far I have followed this link to add the user role attribute in User model and the views of Sign up and Log in. roles based authetication using enum
But I am facing an issue. Whenever the sign up operation is performed I get the following error message Error Message
In my Users model I have following code
class User < ApplicationRecord
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :validatable
enum role: [:manager, :developer, :QA]
end
In my view, I have following code for displaying the drop down menu
<div class="field">
<%= f.label :role %><br />
<%= f.select :role, User.roles %>
</div>
My application controller contains following code
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
before_action :configure_permitted_parameters, if: :devise_controller?
protected
def configure_permitted_parameters
devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :email, :password, :role])
end
end