Class: Spree::Api::V1::ImagesController
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#map_nested_attributes_keys
included
Instance Method Details
#create ⇒ Object
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
|
#destroy ⇒ Object
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
|
#show ⇒ Object
5
6
7
|
# File 'app/controllers/spree/api/v1/images_controller.rb', line 5
def show
@image = Image.find(params[:id])
end
|
#update ⇒ Object
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
|