Class: Spree::Api::V1::ProductPropertiesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::V1::ProductPropertiesController
show all
- Defined in:
- app/controllers/spree/api/v1/product_properties_controller.rb
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#content_type, #permitted_line_item_attributes
included
Instance Method Details
[View source]
21
22
23
24
25
26
27
28
29
|
# File 'app/controllers/spree/api/v1/product_properties_controller.rb', line 21
def create
authorize! :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
|
[View source]
41
42
43
44
45
|
# File 'app/controllers/spree/api/v1/product_properties_controller.rb', line 41
def destroy
authorize! :destroy, @product_property
@product_property.destroy
respond_with(@product_property, status: 204)
end
|
[View source]
8
9
10
11
12
13
|
# File 'app/controllers/spree/api/v1/product_properties_controller.rb', line 8
def index
@product_properties = @product.product_properties.accessible_by(current_ability, :read).
ransack(params[:q]).result.
page(params[:page]).per(params[:per_page])
respond_with(@product_properties)
end
|
[View source]
19
|
# File 'app/controllers/spree/api/v1/product_properties_controller.rb', line 19
def new; end
|
[View source]
15
16
17
|
# File 'app/controllers/spree/api/v1/product_properties_controller.rb', line 15
def show
respond_with(@product_property)
end
|
[View source]
31
32
33
34
35
36
37
38
39
|
# File 'app/controllers/spree/api/v1/product_properties_controller.rb', line 31
def update
authorize! :update, @product_property
if @product_property.update_attributes(product_property_params)
respond_with(@product_property, status: 200, default_template: :show)
else
invalid_resource!(@product_property)
end
end
|