Sha256: 1b5fbee28aa6969d40ba03fdf0aaf04476671beb4e29f949cdfd83c25d26a4cc

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 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
      raise ArgumentError, "We need a logger to get logs" unless Rails.logger
      Rails.logger.extend Footnotes::LoggingExtensions
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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