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
16 17 18 19 20 |
# File 'app/controllers/spree/api/images_controller.rb', line 16 def create :create, Image @image = scope.images.create(image_params) respond_with(@image, status: 201, default_template: :show) end |
#destroy ⇒ Object
28 29 30 31 32 |
# File 'app/controllers/spree/api/images_controller.rb', line 28 def destroy @image = scope.images.accessible_by(current_ability, :destroy).find(params[:id]) @image.destroy respond_with(@image, status: 204) end |
#index ⇒ Object
6 7 8 9 |
# File 'app/controllers/spree/api/images_controller.rb', line 6 def index @images = scope.images.accessible_by(current_ability) respond_with(@images) end |
#show ⇒ Object
11 12 13 14 |
# File 'app/controllers/spree/api/images_controller.rb', line 11 def show @image = scope.images.accessible_by(current_ability, :show).find(params[:id]) respond_with(@image) end |
#update ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/spree/api/images_controller.rb', line 22 def update @image = scope.gallery.images.accessible_by(current_ability, :update).find(params[:id]) @image.update(image_params) respond_with(@image, default_template: :show) end |