Sha256: 1e6848d13fdd8a61a16e331c955a0c500cd26b01b84be327e8fe50523ba9b301

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

require "rails/engine"

module AhoyEmail
  class Engine < ::Rails::Engine
    initializer "ahoy_email" do |app|
      AhoyEmail.secret_token ||= begin
        creds =
          if app.respond_to?(:credentials) && app.credentials.secret_key_base
            app.credentials
          elsif app.respond_to?(:secrets)
            app.secrets
          else
            app.config
          end

        creds.respond_to?(:secret_key_base) ? creds.secret_key_base : creds.secret_token
      end

      AhoyEmail.belongs_to = {optional: true} if Rails::VERSION::MAJOR >= 5
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ahoy_email-0.5.2 lib/ahoy_email/engine.rb