Sha256: 484714a50db1b17665e2cd4486884dfba07f04e9861b27c8f4b480136d2f75ea

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Footnotes

  class Railtie < ::Rails::Railtie
    config.before_configuration do
      if ::Rails.env.development?
        require 'rails-footnotes/footnotes'
        require 'rails-footnotes/backtracer'
        require 'rails-footnotes/view_subscriber'

        # Require each individual note
        notes_glob = File.expand_path("../rails-footnotes/notes/*.rb", __FILE__)
        Dir[notes_glob].each{|note| require note }

        # Subscribe to view events so we can use them later
        ActiveSupport::LogSubscriber.attach_to(:action_view, Footnotes.view_subscriber)

        # The footnotes are applied by default to all actions. To remove the
        # footnotes from an action, use skip_filter in your controller.
        ActionController::Base.prepend_before_filter Footnotes::BeforeFilter
        ActionController::Base.after_filter Footnotes::AfterFilter
      end
    end

    # Hook into the logger so we can collect logs
    initializer "rails3-footnotes.hook_logger" do
      if ::Rails.env.development?
        raise ArgumentError, "The logs footnote requires a logger" unless Rails.logger
        Rails.logger.extend Footnotes::LoggingExtensions
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails3-footnotes-4.0.0.pre.8 lib/rails-footnotes.rb