Sha256: adc3b70b659ca452cc4192ab7920189b0e6feba174bcb13953bd9e345ad4b0f8
Contents?: true
Size: 1.22 KB
Versions: 2
Compression:
Stored size: 1.22 KB
Contents
module SwitchUser if defined? Rails::Engine class Engine < Rails::Engine config.to_prepare do ActionView::Base.send :include, SwitchUserHelper end end else %w(controllers helpers).each do |dir| path = File.join(File.dirname(__FILE__), '..', 'app', dir) $LOAD_PATH << path ActiveSupport::Dependencies.load_paths << path ActiveSupport::Dependencies.load_once_paths.delete(path) ActionView::Base.send :include, SwitchUserHelper end end mattr_accessor :provider self.provider = :devise mattr_accessor :available_users self.available_users = { :user => lambda { User.all } } mattr_accessor :available_users_identifiers self.available_users_identifiers = { :user => :id } mattr_accessor :available_users_names self.available_users_names = { :user => :email } mattr_accessor :controller_guard self.controller_guard = lambda { |current_user, request| Rails.env.development? } mattr_accessor :view_guard self.view_guard = lambda { |current_user, request| Rails.env.development? } mattr_accessor :redirect_path self.redirect_path = lambda { |request, params| request.env["HTTP_REFERER"] ? :back : root_path } def self.setup yield self end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
switch_user-0.8.0 | lib/switch_user.rb |
switch_user-0.7.0 | lib/switch_user.rb |