Class: Workarea::Api::Admin::TaxCategoriesController
Instance Method Summary
collapse
#current_user, #sort_direction, #sort_field
Instance Method Details
#bulk ⇒ Object
225
226
227
228
229
230
231
232
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 225
def bulk
@bulk = Api::Admin::BulkUpsert.create!(
klass: Tax::Category,
data: params[:tax_categories].map(&:to_h)
)
head :no_content
end
|
#create ⇒ Object
81
82
83
84
85
86
87
88
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 81
def create
@tax_category = Tax::Category.create!(params[:tax_category])
respond_with(
{ tax_category: @tax_category },
{ status: :created,
location: tax_category_path(@tax_category) }
)
end
|
#destroy ⇒ Object
191
192
193
194
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 191
def destroy
@tax_category.destroy
head :no_content
end
|
#index ⇒ Object
72
73
74
75
76
77
78
79
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 72
def index
@tax_categories = Tax::Category
.all
.order_by(sort_field => sort_direction)
.page(params[:page])
respond_with tax_categories: @tax_categories
end
|
#show ⇒ Object
182
183
184
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 182
def show
respond_with tax_category: @tax_category
end
|
#update ⇒ Object
186
187
188
189
|
# File 'app/controllers/workarea/api/admin/tax_categories_controller.rb', line 186
def update
@tax_category.update_attributes!(params[:tax_category])
respond_with tax_category: @tax_category
end
|