Sha256: 4744c566556db9bb51debaa8cdf5a98955bd8196e6cb4963f73c80dc45592edf

Contents?: true

Size: 1.4 KB

Versions: 2

Compression:

Stored size: 1.4 KB

Contents

module RocketCMS
  class Engine < ::Rails::Engine
    rake_tasks do
      require File.expand_path('../tasks', __FILE__)
    end

    initializer "rocket_cms.email_defaults" do
      # Write default email settings to DB so they can be changed.
      if Settings.table_exists?
        Settings.default_email_from(default: 'noreply@rscx.ru')
        Settings.form_email(default: 'glebtv@ya.ru')
        Settings.email_topic(default: 'с сайта')
      end
    end

    initializer 'rocket_cms.paperclip' do
      require 'paperclip/style'
      module ::Paperclip
        class Style
          alias_method :processor_options_without_auto_orient, :processor_options
          def processor_options
            processor_options_without_auto_orient.merge(auto_orient: false)
          end
        end
      end
    end

    initializer 'rocket_cms.simple_form_error_msg' do
      #  https://github.com/rs-pro/russian/blob/master/lib/russian/active_model_ext/custom_error_message.rb
      module SimpleForm
        module Components
          module Errors
            protected
            def errors_on_attribute
              object.errors[attribute_name].map {|m| m.sub(/^\^/, '')}
            end
          end
        end
      end
    end

    config.after_initialize do
      # trigger autoload so models are registered in Mongoid::Elasticearch
      RocketCMS.configuration.search_models.map(&:constantize)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rocket_cms-0.5.9 lib/rocket_cms/engine.rb
rocket_cms-0.5.8 lib/rocket_cms/engine.rb