Sha256: 0cb7c78ef0c762ab0e644917964f4cc95a6125b71a3c4cce9d0dee9a903bb25f

Contents?: true

Size: 1002 Bytes

Versions: 62

Compression:

Stored size: 1002 Bytes

Contents

module Hobo
  module MailerHelper
    attr_reader :app_name, :host

    def initialize(*)
      super
      @app_name = Rails.application.config.hobo.app_name
      if self.class.default_url_options.empty?
        # might be set later in the before filter so we try to set it here
        d = Rails.application.config.action_mailer.default_url_options
        self.class.default_url_options = d.dup if d
      end
      @host = self.class.default_url_options[:host]
    end


    module ClassMethods
      def app_name
        @app_name ||= Rails.application.config.hobo.app_name
      end

      def host
        @host ||= begin
          if default_url_options[:host].nil?
            d = Rails.application.config.action_mailer.default_url_options
            d && d[:host].dup
          else
            default_url_options[:host]
          end
        end
      end
    end

  end
end

ActionMailer::Base.send :include, Hobo::MailerHelper
ActionMailer::Base.extend Hobo::MailerHelper::ClassMethods

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
hobo-2.2.6 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.2.5 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.2.4 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.2.3 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.2.2 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.2.1 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.2.0 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.2 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.1 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.0 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.0.pre4 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.0.pre3 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.0.pre2 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.1.0.pre1 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.0.1 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.0.0 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.0.0.pre10 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.0.0.pre9 lib/hobo/extensions/action_mailer/helper.rb
hobo-2.0.0.pre8 lib/hobo/extensions/action_mailer/helper.rb
hobo-1.3.3 lib/hobo/extensions/action_mailer/helper.rb