Sha256: 6a9c1b22d066fd896e0cf61314b2164f9fd4db9698c77e98337c3f2f2571ea47

Contents?: true

Size: 1.23 KB

Versions: 2

Compression:

Stored size: 1.23 KB

Contents

# encoding: utf-8
require 'rails'
require 'freeberry'

module Freeberry
  class Engine < ::Rails::Engine   
    config.before_initialize do
      ::ActiveSupport::XmlMini.backend = 'Nokogiri'
      
      ::Responders::FlashResponder.flash_keys = [ :success, :failure ]
      ::InheritedResources.flash_keys = [ :success, :failure ]
        
      config.i18n.load_path += Dir[File.join(File.dirname(__FILE__), "../../config", 'locales', '**', '*.{rb,yml}').to_s]
      
      ::I18n::Backend::Simple.send(:include, ::I18n::Backend::Pluralization)
      
      ::ActiveSupport.on_load :active_record do
        ::ActiveRecord::Base.send :include, Freeberry::MysqlUtils
        ::ActiveRecord::Base.send :include, Freeberry::AccessibleAttributes
      end
    end
    
    config.after_initialize do
      ::ActionController::Base.send :include, Freeberry::Controllers::HeadOptions
      ::ActionView::Base.send :include, Freeberry::Controllers::HelperUtils
      
      ::Paperclip.interpolates('basename') do |attachment, style|
        Freeberry::Utils.parameterize_filename(attachment.original_filename.gsub(/#{File.extname(attachment.original_filename)}$/, ""))
      end
    end
    
    rake_tasks do
      load "tasks/freeberry.rake"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
freeberry-0.3.0 lib/freeberry/railtie.rb
freeberry-0.2.9 lib/freeberry/railtie.rb