Class: Spree::Api::ImagesController
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#map_nested_attributes_keys, #set_jsonp_format
included
Instance Method Details
#create ⇒ Object
11
12
13
14
15
|
# File 'app/controllers/spree/api/images_controller.rb', line 11
def create
authorize! :create, Image
@image = Image.create(params[:image])
respond_with(@image, :status => 201, :default_template => :show)
end
|
#destroy ⇒ Object
24
25
26
27
28
29
|
# File 'app/controllers/spree/api/images_controller.rb', line 24
def destroy
authorize! :delete, Image
@image = Image.find(params[:id])
@image.destroy
respond_with(@image, :status => 204)
end
|
#show ⇒ Object
6
7
8
9
|
# File 'app/controllers/spree/api/images_controller.rb', line 6
def show
@image = Image.find(params[:id])
respond_with(@image)
end
|
#update ⇒ Object
17
18
19
20
21
22
|
# File 'app/controllers/spree/api/images_controller.rb', line 17
def update
authorize! :update, Image
@image = Image.find(params[:id])
@image.update_attributes(params[:image])
respond_with(@image, :default_template => :show)
end
|