feat(email_list): add strong params
This commit is contained in:
parent
b16b7d7b58
commit
0cf21bb1c9
2 changed files with 13 additions and 4 deletions
|
@ -8,12 +8,18 @@ module Nonprofits
|
||||||
before_action :authenticate_nonprofit_user!
|
before_action :authenticate_nonprofit_user!
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render_json { Qx.fetch(:email_lists, nonprofit_id: params[:nonprofit_id]) }
|
render_json { Qx.fetch(:email_lists, nonprofit_id: email_list_params[:nonprofit_id]) }
|
||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
tag_master_ids = params['tag_masters'].values.map(&:to_i)
|
tag_master_ids = email_list_params[:tag_masters].values.map(&:to_i)
|
||||||
render_json { InsertEmailLists.for_mailchimp(params[:nonprofit_id], tag_master_ids) }
|
render_json { InsertEmailLists.for_mailchimp(email_list_params[:nonprofit_id], tag_master_ids) }
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def email_list_params
|
||||||
|
params.permit(:nonprofit_id, :tag_masters)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
|
||||||
class EmailList < ApplicationRecord
|
class EmailList < ApplicationRecord
|
||||||
# attr_accessible :list_name, :mailchimp_list_id, :nonprofit, :tag_master
|
# :list_name,
|
||||||
|
# :mailchimp_list_id,
|
||||||
|
# :nonprofit,
|
||||||
|
# :tag_master
|
||||||
belongs_to :nonprofit
|
belongs_to :nonprofit
|
||||||
belongs_to :tag_master
|
belongs_to :tag_master
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue