Sha256: 64f577abf152a9b9f9f75f0ad7f5ef170fb5a9b169c9c60b33cdc11228dd4dba

Contents?: true

Size: 528 Bytes

Versions: 1

Compression:

Stored size: 528 Bytes

Contents

module Recommendable
  class Railtie < Rails::Railtie
    ActiveRecord::Base.send :include, Recommendable::ActsAsRecommendedTo
    ActiveRecord::Base.send :include, Recommendable::ActsAsRecommendable

    # Force load models if in a non-development environment and not caching classes
    config.after_initialize do |app|
      force_load_models if !Rails.env.development? && !app.config.cache_classes
    end

    def self.force_load_models
      Dir["#{ Rails.root }/app/models/**/*.rb"].each { |m| load m }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
recommendable-0.1.3 lib/recommendable/railtie.rb