feat(roles): add strong params
This commit is contained in:
parent
27f9d3bda9
commit
9d2d6425ab
2 changed files with 10 additions and 6 deletions
|
@ -7,7 +7,7 @@ class RolesController < ApplicationController
|
|||
before_action :authenticate_nonprofit_admin!
|
||||
|
||||
def create
|
||||
role = Role.create_for_nonprofit(params[:role][:name].to_sym, params[:role][:email], FetchNonprofit.with_params(params))
|
||||
role = Role.create_for_nonprofit(role_params[:name].to_sym, role_params[:email], FetchNonprofit.with_params(params))
|
||||
json_saved role, 'User successfully added!'
|
||||
end
|
||||
|
||||
|
@ -22,4 +22,10 @@ class RolesController < ApplicationController
|
|||
render json: {}
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def role_params
|
||||
params.require(:role).permit(:name, :email)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,8 +11,6 @@ class Role < ApplicationRecord
|
|||
:event_editor # //
|
||||
].freeze
|
||||
|
||||
# TODO:
|
||||
# attr_accessible \
|
||||
# :name,
|
||||
# :user_id, :user,
|
||||
# :host, :host_id, :host_type # nil, "Nonprofit", "Campaign", "Event"
|
||||
|
|
Loading…
Reference in a new issue