Created
June 14, 2011 12:27
-
-
Save mattrw89/1024802 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. | |
| @question_sheets.collect(&:id).each do |x| | |
| ContactAssignment.create!(:person_id => id, :question_sheet_id => x, :assigned_to_id => @assign_to.id) | |
| end | |
| end | |
| else | |
| end | |
| render :nothing => true | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment