Reputation: 1
I have a controller create method like this.
def create
if user.save!
user.add_role = params[:user][:Role].parameterize('_').to_sym
if current_user.has_role?(:producer_or_beat_maker_or_composer)
#if(Student.find_by_email("#{current_user.email}")!= nil)
redirect_to(:controller => 'users',:action => new_registration_path(resource_name))
elsif current_user.role=="Producer"
redirect_to(:controller => 'users',:action => 'index')
end
end
end
when i click on user creation,i got an error like " undefined method `parameterize' for nil:NilClass". please help through this..
Upvotes: 0
Views: 536
Reputation: 51151
This one is quite simple params[:user][:Role]
is nil
. Perhaps you meant params[:user][:role]
.
Upvotes: 2