Class: Spree::Api::V1::ImagesController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/spree/api/v1/images_controller.rb

Instance Attribute Summary

Attributes inherited from BaseController

#current_api_user

Instance Method Summary collapse

Methods inherited from BaseController

#map_nested_attributes_keys

Methods included from ControllerSetup

included

Instance Method Details

#createObject



9
10
11
12
13
# File 'app/controllers/spree/api/v1/images_controller.rb', line 9

def create
  authorize! :create, Image
  @image = Image.create(params[:image])
  render :show, :status => 201
end

#destroyObject



22
23
24
25
26
27
# File 'app/controllers/spree/api/v1/images_controller.rb', line 22

def destroy
  authorize! :delete, Image
  @image = Image.find(params[:id])
  @image.destroy
  render :text => nil, :status => 204
end

#showObject



5
6
7
# File 'app/controllers/spree/api/v1/images_controller.rb', line 5

def show
  @image = Image.find(params[:id])
end

#updateObject



15
16
17
18
19
20
# File 'app/controllers/spree/api/v1/images_controller.rb', line 15

def update
  authorize! :update, Image
  @image = Image.find(params[:id])
  @image.update_attributes(params[:image])
  render :show, :status => 200
end