Skip to content

Instantly share code, notes, and snippets.

View mattrw89's full-sized avatar

Matt Webb mattrw89

View GitHub Profile
class ContactAssignmentsController < ApplicationController
def create
@organization = Organization.find(params[:org_id])
# @keyword = SmsKeyword.find(params[:keyword])
@question_sheets = @organization.question_sheets
ContactAssignment.where(:person_id => params[:ids], :question_sheet_id => @question_sheets).destroy_all
if params[:assign_to].present?
@assign_to = Person.find(params[:assign_to])
params[:ids].each do |id|
#made it loop through question_sheets, so that all question_sheets are assigned to one person. not sure if this is the desired outcome. need to modify the counts if you want to do this.