Class: Admin::FestivityCategoriesController
- Inherits:
-
ResourceController
- Object
- ResourceController
- Admin::FestivityCategoriesController
- Defined in:
- app/controllers/admin/festivity_categories_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/admin/festivity_categories_controller.rb', line 11 def create category_type = FestivityCategoryType.find(params[:category_type_id]) if category_type.festivity_categories.new(name: params[:name], parent_id: params[:parent_id]).save render partial: 'admin/sites/partials/new_category', :locals => { :category_type => category_type, :category_types => category_type.site.festivity_active_category_types} else render status: :conflict, text: "#{category_type.name} must be unique." end end |
#destroy ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'app/controllers/admin/festivity_categories_controller.rb', line 22 def destroy category = FestivityCategory.find(params[:id]) site = Site.find(category.festivity_category_type.site_id) category.inactive = true if category.save! render partial: 'admin/sites/partials/filters', :locals => { :category_types => site.festivity_active_category_types} end end |
#index ⇒ Object
3 4 5 |
# File 'app/controllers/admin/festivity_categories_controller.rb', line 3 def index end |
#show ⇒ Object
7 8 9 |
# File 'app/controllers/admin/festivity_categories_controller.rb', line 7 def show end |