Sha256: ee25f049c79ce295a7ed5edc66ac2b6b52e49d74abcea9450c88bd1ef60d3bdc

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Msip
  class ApplicationController < ActionController::Base

    # sin autorizacion porque es utilidad para otros controladores
   
    before_action do
      resource = controller_name.singularize.to_sym
      method = "#{resource}_params"
      params[resource] &&= send(method) if respond_to?(method, true)
    end

    before_action :configure_permitted_parameters, 
      if: :devise_controller?

    # AplicaciĆ³n final debe hacer algo como:
    #protect_from_forgery with: :exception
    
    def current_ability
      @current_ability ||= ::Ability.new(current_usuario)
    end

    protected

    def configure_permitted_parameters
      if (Gem.loaded_specs['devise'].version <=> Gem::Version.new('4.0.0')) < 0
        devise_parameter_sanitizer.for(:sign_up) << :nusuario
        devise_parameter_sanitizer.for(:account_update) << 
          [:nombre, :email, :descripcion, :tema_id]
      else
        devise_parameter_sanitizer.permit(:sign_up, keys: [:nusuario])
        devise_parameter_sanitizer.permit(:account_update, keys: 
                                        [:nombre, :email, :descripcion, :tema_id])
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
msip-2.2.0.alfa3 app/controllers/msip/application_controller.rb
msip-2.2.0.alfa2 app/controllers/msip/application_controller.rb
msip-2.2a2 app/controllers/msip/application_controller.rb