Class: RailsI18nManager::TranslationAppsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- RailsI18nManager::TranslationAppsController
- Defined in:
- app/controllers/rails_i18n_manager/translation_apps_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
17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 17 def create @translation_app = TranslationApp.new(permitted_params) if @translation_app.save flash[:notice] = "Successfully created." redirect_to action: :edit, id: @translation_app.id else flash.now[:error] = "Create failed." render "rails_i18n_manager/translation_apps/form" end end |
#destroy ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 47 def destroy if @translation_app.destroy flash[:notice] = "Deleted '#{@translation_app.name}'" else flash[:alert] = "Delete failed" end redirect_to action: :index end |
#edit ⇒ Object
33 34 35 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 33 def edit render "form" end |
#index ⇒ Object
5 6 7 8 9 10 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 5 def index @translation_apps = TranslationApp .sort_order(params[:sort], params[:direction], base_sort_order: "#{TranslationApp.table_name}.name ASC") .multi_search(params[:search]) .page(params[:page]) end |
#new ⇒ Object
12 13 14 15 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 12 def new @translation_app = TranslationApp.new render "form" end |
#show ⇒ Object
29 30 31 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 29 def show redirect_to action: :edit end |
#update ⇒ Object
37 38 39 40 41 42 43 44 45 |
# File 'app/controllers/rails_i18n_manager/translation_apps_controller.rb', line 37 def update if @translation_app.update(permitted_params) flash[:notice] = "Update success." redirect_to action: :index else flash.now[:error] = "Update failed." render "rails_i18n_manager/translation_apps/form" end end |