Module: Cul::Omniauth::Abilities::ClassMethods

Defined in:
app/models/concerns/cul/omniauth/abilities.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(mod) ⇒ Object



89
90
91
92
93
94
95
96
97
# File 'app/models/concerns/cul/omniauth/abilities.rb', line 89

def self.included mod
  mod.config.each do |k,v|
    if v[:includes]
      v[:includes].each do |included|
        Role.role(k).includes(included.to_sym)
      end
    end
  end
end

Instance Method Details

#configObject



79
80
81
82
83
84
85
86
87
88
# File 'app/models/concerns/cul/omniauth/abilities.rb', line 79

def config
  @role_proxy_config ||= begin
    root = (Rails.root.blank?) ? '.' : Rails.root
    path = File.join(root,'config','roles.yml')
    _opts = YAML.load_file(path)
    all_config = _opts.fetch("_all_environments", {})
    env_config = _opts.fetch(Rails.env, {})
    symbolize_hash_keys(all_config.merge(env_config))
  end
end