Sha256: 38b9c8818f313a1e094e8706698d56c478d6848bf1fda0695f750f27587ea6dc

Contents?: true

Size: 1.37 KB

Versions: 4

Compression:

Stored size: 1.37 KB

Contents

require 'rails'
require 'kaminari'
require 'simple_form'
require 'awesome_nested_set'
require 'carrierwave'
require 'enum_field'
require 'friendly_id'
require 'cancan'
require 'cancan_namespace'
require 'page_parts'
require 'meta_manager'
require 'jbuilder'
require 'rails-uploader'
require 'sunrise'

module Sunrise
  class Engine < ::Rails::Engine
    engine_name "sunrise"
    isolate_namespace Sunrise
    
    config.i18n.load_path += Dir[Sunrise.root_path.join('config/locales/**', '*.{rb,yml}')]
    
    initializer "sunrise.setup" do
      I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization)
      I18n::Backend::Simple.send(:include, I18n::Backend::Transliterator)
      
      ActiveSupport.on_load :active_record do
        ActiveRecord::Base.send :include, Sunrise::CarrierWave::Glue
        ActiveRecord::Base.send :include, Sunrise::Utils::Mysql
      end
      
      ActiveSupport.on_load :action_view do
        ActionView::Base.send :include, Sunrise::Views::Helper
      end
      
      FriendlyId.send :include, Sunrise::Hooks::FriendlyId
    end
    
    initializer "sunrise.csv_renderer" do
      ::ActionController::Renderers.add :csv do |collection, options|
        doc = Sunrise::Utils::CsvDocument.new(collection, options)
        send_data(doc.render, :filename => doc.filename, :type => Mime::CSV, :disposition => "attachment")
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sunrise-cms-0.4.2 lib/sunrise/engine.rb
sunrise-cms-0.4.1 lib/sunrise/engine.rb
sunrise-cms-0.4.0 lib/sunrise/engine.rb
sunrise-cms-0.3.3 lib/sunrise/engine.rb