Sha256: bc4316138d0342591d5ff08d0ded343dc040aae7c4c67d0cea43999c0a9c12f5

Contents?: true

Size: 957 Bytes

Versions: 4

Compression:

Stored size: 957 Bytes

Contents

module ActiveRecordViews
  class Railtie < ::Rails::Railtie
    initializer 'active_record_views' do |app|
      ActiveSupport.on_load :active_record do
        ActiveRecordViews.sql_load_path += Rails.application.config.paths['app/models'].to_a
        ActiveRecordViews.init!
        ActiveRecordViews::Extension.create_enabled = !Rails.env.production?
      end

      unless app.config.cache_classes
        if app.respond_to?(:reloader)
          app.reloader.before_class_unload do
            ActiveRecordViews.reload_stale_views!
          end
          app.executor.to_run do
            ActiveRecordViews.reload_stale_views!
          end
        else
          ActiveSupport.on_load :action_controller do
            ActionDispatch::Callbacks.before do
              ActiveRecordViews.reload_stale_views!
            end
          end
        end
      end
    end

    rake_tasks do
      load 'tasks/active_record_views.rake'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activerecord_views-0.1.3 lib/active_record_views/railtie.rb
activerecord_views-0.1.2 lib/active_record_views/railtie.rb
activerecord_views-0.1.1 lib/active_record_views/railtie.rb
activerecord_views-0.1.0 lib/active_record_views/railtie.rb