working on recipient lists

This commit is contained in:
Jared Cosulich 2017-03-02 14:33:58 -05:00
parent 37e01c024b
commit 645d7bc7d5
10 changed files with 49 additions and 17 deletions

View file

@ -1,4 +1,5 @@
class RecipientListsController < ApplicationController
before_action :stringify_recipient_ids, only: [:create, :update]
before_action :set_school
before_action :set_recipient_list, only: [:show, :edit, :update, :destroy]
@ -57,6 +58,13 @@ class RecipientListsController < ApplicationController
@recipient_list = @school.recipient_lists.find(params[:id])
end
def stringify_recipient_ids
ids = params[:recipient_list][:recipient_ids]
if ids.present? && ids.is_a?(Array)
params[:recipient_list][:recipient_ids] = ids.reject { |id| id.empty? }.join(',')
end
end
# Only allow a trusted parameter "white list" through.
def recipient_list_params
params.require(:recipient_list).permit(:name, :description, :recipient_ids)

View file

@ -1,6 +1,7 @@
class WelcomeController < ApplicationController
def index
@schools = School.all
end
end