class OrgProjectsController < ApplicationController def create org_ids = params[:orgNames] @project = Project.find(params[:project_id]) org_ids.each do |org_id| OrgProject.create(:organization_id => org_id.to_i, :project_id => params[:project_id].to_i, :created_at => Time.now) end respond_to do |format| format.js end end def destroy @project = Project.find(params[:project_id]) @org_project = OrgProject.find(params[:id]) @org_project.destroy end end