Class: Spree::Api::ProductPropertiesController
- Inherits:
-
BaseController
- Object
- ActionController::Metal
- BaseController
- Spree::Api::ProductPropertiesController
show all
- Defined in:
- app/controllers/spree/api/product_properties_controller.rb
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#map_nested_attributes_keys, #set_jsonp_format
included
Instance Method Details
#create ⇒ Object
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/spree/api/product_properties_controller.rb', line 23
def create
authorize! :create, ProductProperty
@product_property = @product.product_properties.new(params[:product_property])
if @product_property.save
respond_with(@product_property, :status => 201, :default_template => :show)
else
invalid_resource!(@product_property)
end
end
|
#destroy ⇒ Object
42
43
44
45
46
47
48
49
50
|
# File 'app/controllers/spree/api/product_properties_controller.rb', line 42
def destroy
authorize! :delete, ProductProperty
if(@product_property)
@product_property.destroy
respond_with(@product_property, :status => 204)
else
invalid_resource!(@product_property)
end
end
|
#index ⇒ Object
9
10
11
12
13
14
|
# File 'app/controllers/spree/api/product_properties_controller.rb', line 9
def index
@product_properties = @product.product_properties.
ransack(params[:q]).result.
page(params[:page]).per(params[:per_page])
respond_with(@product_properties)
end
|
#new ⇒ Object
20
21
|
# File 'app/controllers/spree/api/product_properties_controller.rb', line 20
def new
end
|
#show ⇒ Object
16
17
18
|
# File 'app/controllers/spree/api/product_properties_controller.rb', line 16
def show
respond_with(@product_property)
end
|
#update ⇒ Object
33
34
35
36
37
38
39
40
|
# File 'app/controllers/spree/api/product_properties_controller.rb', line 33
def update
authorize! :update, ProductProperty
if @product_property && @product_property.update_attributes(params[:product_property])
respond_with(@product_property, :status => 200, :default_template => :show)
else
invalid_resource!(@product_property)
end
end
|