Created
March 9, 2012 20:21
-
-
Save jvenator/2008472 to your computer and use it in GitHub Desktop.
packages/documents_controller options
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 Packages::DocumentsController < ApplicationController | |
def create | |
@package = Package.find(params[:package_id]) | |
Document.where(:id => params[:id].split(",")).each do |d| | |
@package.add_document(d) | |
end | |
@documents = Document.where(:id => params[:id].split(",")).collect do |d| | |
@package.add_document(d) | |
end | |
def destroy | |
@package = Package.find(params[:package_id]) | |
@package.remove_document(Document.find(params[:id])) | |
@documents = Document.where(["id NOT IN (?)", @package.document_ids]) | |
render("refresh_document_selector", :status => :ok) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment