Sha256: 07ea1cb96c66634a2b4ddf0561a9e2792615a9428a086ffa86064ac99fd72cba
Contents?: true
Size: 1.09 KB
Versions: 24
Compression:
Stored size: 1.09 KB
Contents
module KepplerLanguages module Concerns # Concern con la configuracion de parametros de los formulario module Commons extend ActiveSupport::Concern included do before_action :paginator_params before_action :set_setting end private def paginator_params @search_field = model.search_field if listing? @query = params[:search] unless params[:search].blank? @current_page = params[:page] unless params[:page].blank? end def set_setting @setting = Setting.first end def module_name self.class.to_s.split('::').first.constantize end # Get submit key to redirect, only [:create, :update] def redirect(object, commit) if commit.key?('_save') redirect_to(request.path.split('/')[1..-2].map(&:to_sym).push(object), notice: actions_messages(object)) elsif commit.key?('_add_other') redirect_to( send("new_admin_#{underscore(object)}_path"), notice: actions_messages(object) ) end end end end end
Version data entries
24 entries across 24 versions & 1 rubygems