Sha256: f4b8b5d341a66e5d9352340d3acd7e246bad17d500f0966ea5b247892b011f71
Contents?: true
Size: 974 Bytes
Versions: 65
Compression:
Stored size: 974 Bytes
Contents
module Concerns module Backend module TranslatableController extend ActiveSupport::Concern included do before_action :find_models, only: [:edit_translation, :update_translation] helper_method :translatable_path end def update_translation if @translation.save(params[model_name]) redirect_to translatable_path, notice: t('b.msg.changes_saved') else render :edit_translation end end private def find_models @model ||= find_model @translation = translation_form end def model_name @model.class.to_s.underscore.gsub('_decorator', '') end def set_translatable_path(path) @translatable_path ||= path end def translatable_path method = "edit_translation_backend_#{model_name}_path" @translatable_path || send(method, @model, params[:translation_locale]) end end end end
Version data entries
65 entries across 65 versions & 1 rubygems