Class: Lines::Admin::PicturesController

Inherits:
Lines::ApplicationController show all
Defined in:
app/controllers/lines/admin/pictures_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



8
9
10
# File 'app/controllers/lines/admin/pictures_controller.rb', line 8

def create
  @picture = Lines::Picture.create(picture_params)
end

#destroyObject

Deletes a picture. Only responds to JS requests.



26
27
28
29
30
31
32
33
# File 'app/controllers/lines/admin/pictures_controller.rb', line 26

def destroy
  @picture = Lines::Picture.find(params[:id])
  @picture.destroy

  respond_to do |format|
    format.js
  end
end

#updateObject

PUT /admin/pictures/1



13
14
15
16
17
18
19
20
21
22
23
# File 'app/controllers/lines/admin/pictures_controller.rb', line 13

def update
  @picture = Lines::Picture.find(params[:id])

  respond_to do |format|
    if @picture.update_attributes(picture_params[:picture])
      format.html { redirect_to @picture }
    else
      format.html { render action: "edit" }
    end
  end
end