Sha256: a1f8d7e90487c15d27aa6d83346cccf4f2bc8115dd42278df3737530d6466298

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

module MailEngine
  class Engine < Rails::Engine
    require 'mail_engine'

    initializer "mail_engine" do
      ActionMailer::Base.send(:include, MailEngine::Sendgrid::Base)
      require 'mail_engine/action_mailer_patch'
    end

    initializer "mail_engine.register_liquid_template" do
      require 'liquid'
      require 'extras/liquid_view'
      ActionView::Template.register_template_handler(:liquid, LiquidView)
    end

    initializer "mail_engine.register_database_template" do
      ActionMailer::Base.layout "layouts/mail_engine/mail_template_layouts/none"
      ActionMailer::Base.send(:prepend_view_path, MailEngine::MailTemplate::Resolver.instance)
    end

    initializer "mail_engine.add_acts_as_mail_receiver" do
      ActiveRecord::Base.send(:include, MailEngine::ActsAsMailReceiver)
    end

    rake_tasks do
      load "mail_engine/tasks/sendmail.rake"
    end

    generators do
      require 'mail_engine/generators/install.rb'
      require 'mail_engine/generators/create_config.rb'
      require 'mail_engine/generators/copy_resources.rb'
      require 'mail_engine/generators/copy_migrations.rb'
    end

    config.to_prepare do
      MailEngine::Configuration.load
      raise "Please add :user_class_name config into mail_engine_config.yml." if MailEngine::Base.current_config["user_class_name"].blank?
      MailEngine::USER_MODEL = MailEngine::Base.current_config["user_class_name"].constantize unless defined?(MailEngine::USER_MODEL)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mail_engine-0.1.0 lib/mail_engine/engine.rb