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