Sha256: 868d71b58ccd7521638e12fb6a5791a30e1649ca90d61bbe01deb86bc1621429

Contents?: true

Size: 552 Bytes

Versions: 9

Compression:

Stored size: 552 Bytes

Contents

require 'polyblock/view_helpers'
require 'polyblock/glue'

module Polyblock
  require 'rails'

  class Railtie < Rails::Railtie
    initializer "polyblock.insert_into_active_record" do |app|
      ActiveSupport.on_load :active_record do
        Polyblock::Railtie.insert
      end
    end
    initializer "polyblock.view_helpers" do
      ActionView::Base.send :include, ViewHelpers
    end
  end

  class Railtie
    def self.insert
      if defined?(ActiveRecord)
        ActiveRecord::Base.send(:include, Polyblock::Glue)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
polyblock-0.8.8 lib/polyblock/railtie.rb
polyblock-0.8.7 lib/polyblock/railtie.rb
polyblock-0.8.6 lib/polyblock/railtie.rb
polyblock-0.8.5 lib/polyblock/railtie.rb
polyblock-0.8.4 lib/polyblock/railtie.rb
polyblock-0.8.3 lib/polyblock/railtie.rb
polyblock-0.8.2 lib/polyblock/railtie.rb
polyblock-0.8.1 lib/polyblock/railtie.rb
polyblock-0.8.0 lib/polyblock/railtie.rb