Class: AssetManager::AssetCategoriesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- AssetManager::AssetCategoriesController
- Defined in:
- app/controllers/asset_manager/asset_categories_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 25 def create @asset_category = AssetCategory.new(params[:asset_category]) if @asset_category.save redirect_to edit_asset_category_url(@asset_category), flash: { success: t('asset_manager.asset_categories.controller.asset_category_successfully_create') } else render action: 'new' end end |
#destroy ⇒ Object
43 44 45 46 47 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 43 def destroy @asset_category = AssetCategory.find(params[:id]) @asset_category.destroy redirect_to asset_categories_url end |
#edit ⇒ Object
20 21 22 23 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 20 def edit @asset_category = AssetCategory.find(params[:id]) @asset_category = build_translations(@asset_category) end |
#index ⇒ Object
5 6 7 8 9 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 5 def index @search = AssetManager::AssetCategory.(params[:search]) @asset_categories = @search.relation.send(Kaminari.config.page_method_name, params[Kaminari.config.param_name]).per(50).order('id DESC') @total_records = @search.relation.count end |
#new ⇒ Object
15 16 17 18 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 15 def new @asset_category = AssetCategory.new @asset_category = build_translations(@asset_category) end |
#show ⇒ Object
11 12 13 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 11 def show @asset_category = AssetCategory.find(params[:id]) end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/asset_manager/asset_categories_controller.rb', line 34 def update @asset_category = AssetCategory.find(params[:id]) if @asset_category.update_attributes(params[:asset_category]) redirect_to edit_asset_category_url(@asset_category), flash: { success: t('asset_manager.asset_categories.controller.asset_category_successfully_update') } else render action: 'edit' end end |