Class: Spree::Api::ImagesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::ImagesController
- Defined in:
- app/controllers/spree/api/images_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
14 15 16 17 18 |
# File 'app/controllers/spree/api/images_controller.rb', line 14 def create :create, Image @image = scope.images.create(image_params) respond_with(@image, status: 201, default_template: :show) end |
#destroy ⇒ Object
26 27 28 29 30 |
# File 'app/controllers/spree/api/images_controller.rb', line 26 def destroy @image = scope.images.accessible_by(current_ability, :destroy).find(params[:id]) @image.destroy respond_with(@image, status: 204) end |
#index ⇒ Object
4 5 6 7 |
# File 'app/controllers/spree/api/images_controller.rb', line 4 def index @images = scope.images.accessible_by(current_ability, :read) respond_with(@images) end |
#show ⇒ Object
9 10 11 12 |
# File 'app/controllers/spree/api/images_controller.rb', line 9 def show @image = Image.accessible_by(current_ability, :read).find(params[:id]) respond_with(@image) end |
#update ⇒ Object
20 21 22 23 24 |
# File 'app/controllers/spree/api/images_controller.rb', line 20 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 |