lib/symmetric_encryption/railtie.rb in symmetric-encryption-4.3.0 vs lib/symmetric_encryption/railtie.rb in symmetric-encryption-4.3.1

- old
+ new

@@ -27,11 +27,12 @@ # Loaded before Active Record initializes since database.yml can have encrypted # passwords in it config.before_configuration do # Check if already configured unless ::SymmetricEncryption.cipher? - app_name = Rails::Application.subclasses.first.parent.to_s.underscore + parent_method = Module.method_defined?(:module_parent) ? 'module_parent' : 'parent' + app_name = Rails::Application.subclasses.first.send(parent_method).to_s.underscore env_var = ENV['SYMMETRIC_ENCRYPTION_CONFIG'] config_file = if env_var Pathname.new(File.expand_path(env_var)) else @@ -39,14 +40,14 @@ end if config_file.file? begin ::SymmetricEncryption::Config.load!(file_name: config_file, env: ENV['SYMMETRIC_ENCRYPTION_ENV'] || Rails.env) - rescue ArgumentError => exc + rescue ArgumentError => e puts "\nSymmetric Encryption not able to read keys." - puts "#{exc.class.name} #{exc.message}" + puts "#{e.class.name} #{e.message}" puts "To generate a new config file and key files: symmetric-encryption --generate --app-name #{app_name}\n\n" - raise(exc) + raise(e) end end end end