lib/authoreyes/railtie.rb in authoreyes-0.2.1 vs lib/authoreyes/railtie.rb in authoreyes-0.2.2
- old
+ new
@@ -8,28 +8,28 @@
# Allow users to configure Authoreyes in an initializer file
# +auth_rules_file+ is the path of the authorization rules file.
config.authoreyes = ActiveSupport::OrderedOptions.new
- initializer 'authoreyes.setup', before: 'authoreyes.engine' do |app|
+ initializer 'authoreyes.setup', before: 'authoreyes.engine' do |_app|
# Set default Authoreyes options
default_options = ActiveSupport::OrderedOptions.new
default_options.auth_rules_file =
File.path("#{Rails.root}/config/authorization_rules.rb")
default_options.mode = :whitelist
# Validates options
unless [nil, :whitelist, :blacklist].include? config.authoreyes.mode
raise InvalidConfigurationOption,
- "Unrecognized mode. Valid options are :whitelist and :blacklist"
+ 'Unrecognized mode. Valid options are :whitelist and :blacklist'
end
# Merge user options with defaults
config.authoreyes = default_options.merge(config.authoreyes)
end
# Controller integration
- initializer 'authoreyes.in_controller' do |app|
+ initializer 'authoreyes.in_controller' do |_app|
ActiveSupport.on_load :action_controller do
if Rails.application.config.api_only
before_action :render_unauthorized
else
before_action :redirect_if_unauthorized