Class: Spree::Api::ProductPropertiesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::ProductPropertiesController
- Defined in:
- app/controllers/spree/api/product_properties_controller.rb
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/spree/api/product_properties_controller.rb', line 28 def create :create, ProductProperty @product_property = @product.product_properties.new(product_property_params) if @product_property.save respond_with(@product_property, status: 201, default_template: :show) else invalid_resource!(@product_property) end end |
#destroy ⇒ Object
47 48 49 50 51 |
# File 'app/controllers/spree/api/product_properties_controller.rb', line 47 def destroy :destroy, @product_property @product_property.destroy respond_with(@product_property, status: 204) end |
#index ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/spree/api/product_properties_controller.rb', line 9 def index @product_properties = @product. product_properties. accessible_by(current_ability). ransack(params[:q]). result @product_properties = paginate(@product_properties) respond_with(@product_properties) end |
#new ⇒ Object
25 26 |
# File 'app/controllers/spree/api/product_properties_controller.rb', line 25 def new end |
#show ⇒ Object
21 22 23 |
# File 'app/controllers/spree/api/product_properties_controller.rb', line 21 def show respond_with(@product_property) end |
#update ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/controllers/spree/api/product_properties_controller.rb', line 38 def update :update, @product_property if @product_property.update(product_property_params) respond_with(@product_property, status: 200, default_template: :show) else invalid_resource!(@product_property) end end |