class OrgCoursesController < ApplicationController def create org_ids = params[:orgNames] @course = Course.find(params[:course_id]) org_ids.each do |org_id| OrgCourse.create(:organization_id => org_id.to_i, :course_id => params[:course_id].to_i, :created_at => Time.now) end respond_to do |format| format.js end end def destroy @course = Course.find(params[:course_id]) @org_course = OrgCourse.find(params[:id]) @org_course.destroy end end