Class: Droom::DocumentsController

Inherits:
EngineController show all
Defined in:
app/controllers/droom/documents_controller.rb

Instance Method Summary collapse

Methods inherited from EngineController

#current_ability

Instance Method Details

#createObject



29
30
31
32
# File 'app/controllers/droom/documents_controller.rb', line 29

def create
  @document.save!
  render :partial => 'created'
end

#destroyObject



43
44
45
46
# File 'app/controllers/droom/documents_controller.rb', line 43

def destroy
  @document.destroy
  head :ok
end

#editObject



34
35
36
# File 'app/controllers/droom/documents_controller.rb', line 34

def edit
  render 
end

#indexObject



9
10
11
12
13
14
15
# File 'app/controllers/droom/documents_controller.rb', line 9

def index
  @documents = @documents.matching(params[:q]) unless params[:q].blank?
  @documents = paginated(@documents)
  respond_with @documents do |format|
    format.js { render :partial => 'droom/documents/documents' }
  end
end

#newObject



25
26
27
# File 'app/controllers/droom/documents_controller.rb', line 25

def new
  render 
end

#showObject



17
18
19
20
21
22
23
# File 'app/controllers/droom/documents_controller.rb', line 17

def show
  if @document.file
    redirect_to @document.file.expiring_url(Time.now + 600)
  else
    raise ActiveRecord::RecordNotFound
  end
end

#updateObject



38
39
40
41
# File 'app/controllers/droom/documents_controller.rb', line 38

def update
  @document.save!
  render :partial => 'listing', :object => @document.with_event
end