Class: Spree::Api::V1::TaxonomiesController
- Inherits:
-
BaseController
- Object
- ActionController::Base
- BaseController
- Spree::Api::V1::TaxonomiesController
show all
- Defined in:
- app/controllers/spree/api/v1/taxonomies_controller.rb
Instance Attribute Summary
#current_api_user
Instance Method Summary
collapse
#content_type, #map_nested_attributes_keys, #permitted_line_item_attributes
included
Instance Method Details
#create ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'app/controllers/spree/api/v1/taxonomies_controller.rb', line 19
def create
authorize! :create, Taxonomy
@taxonomy = Taxonomy.new(taxonomy_params)
if @taxonomy.save
respond_with(@taxonomy, :status => 201, :default_template => :show)
else
invalid_resource!(@taxonomy)
end
end
|
#destroy ⇒ Object
38
39
40
41
42
|
# File 'app/controllers/spree/api/v1/taxonomies_controller.rb', line 38
def destroy
authorize! :destroy, taxonomy
taxonomy.destroy
respond_with(taxonomy, :status => 204)
end
|
#index ⇒ Object
6
7
8
|
# File 'app/controllers/spree/api/v1/taxonomies_controller.rb', line 6
def index
respond_with(taxonomies)
end
|
#jstree ⇒ Object
Because JSTree wants parameters in a slightly different format
15
16
17
|
# File 'app/controllers/spree/api/v1/taxonomies_controller.rb', line 15
def jstree
show
end
|
#show ⇒ Object
10
11
12
|
# File 'app/controllers/spree/api/v1/taxonomies_controller.rb', line 10
def show
respond_with(taxonomy)
end
|
#update ⇒ Object
29
30
31
32
33
34
35
36
|
# File 'app/controllers/spree/api/v1/taxonomies_controller.rb', line 29
def update
authorize! :update, taxonomy
if taxonomy.update_attributes(taxonomy_params)
respond_with(taxonomy, :status => 200, :default_template => :show)
else
invalid_resource!(taxonomy)
end
end
|