feat(email_list): add strong params

This commit is contained in:
Luis Castro 2019-08-06 16:06:14 +02:00 committed by Eric Schultz
parent b16b7d7b58
commit 0cf21bb1c9
2 changed files with 13 additions and 4 deletions

View file

@ -8,12 +8,18 @@ module Nonprofits
before_action :authenticate_nonprofit_user!
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
def create
tag_master_ids = params['tag_masters'].values.map(&:to_i)
render_json { InsertEmailLists.for_mailchimp(params[:nonprofit_id], tag_master_ids) }
tag_master_ids = email_list_params[:tag_masters].values.map(&:to_i)
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

View file

@ -2,7 +2,10 @@
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
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 :tag_master
end