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!
|
before_action :authenticate_nonprofit_admin!
|
||||||
|
|
||||||
def create
|
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!'
|
json_saved role, 'User successfully added!'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -22,4 +22,10 @@ class RolesController < ApplicationController
|
||||||
render json: {}
|
render json: {}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def role_params
|
||||||
|
params.require(:role).permit(:name, :email)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,8 +11,6 @@ class Role < ApplicationRecord
|
||||||
:event_editor # //
|
:event_editor # //
|
||||||
].freeze
|
].freeze
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# attr_accessible \
|
|
||||||
# :name,
|
# :name,
|
||||||
# :user_id, :user,
|
# :user_id, :user,
|
||||||
# :host, :host_id, :host_type # nil, "Nonprofit", "Campaign", "Event"
|
# :host, :host_id, :host_type # nil, "Nonprofit", "Campaign", "Event"
|
||||||
|
|
Loading…
Reference in a new issue