Sha256: 63d7589255df6d359821d1f6e1f5c1d624496246ca1242254445b6bb3d08478f

Contents?: true

Size: 842 Bytes

Versions: 8

Compression:

Stored size: 842 Bytes

Contents

# encoding: utf-8

require 'action_controller'
require 'action_view'

require_relative 'controller_extensions'
require_relative 'view_extensions'

module Loaf
  class RailtieHelpers
    class << self
      def insert_view
        ActionController::Base.helper Loaf::ViewExtensions
      end

      def insert_controller
        ActionController::Base.send :include, Loaf::ControllerExtensions
      end
    end
  end # RailtieHelpers

  if defined?(Rails::Railtie)
    class Railtie < Rails::Railtie
      initializer "loaf.extend_action_controller_base" do |app|
        ActiveSupport.on_load :action_controller do
          Loaf::RailtieHelpers.insert_controller
          Loaf::RailtieHelpers.insert_view
        end
      end
    end
  else
    Loaf::RailtieHelpers.insert_controller
    Loaf::RailtieHelpers.insert_view
  end
end # Loaf

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
loaf-0.10.0 lib/loaf/railtie.rb
loaf-0.9.0 lib/loaf/railtie.rb
loaf-0.8.1 lib/loaf/railtie.rb
loaf-0.8.0 lib/loaf/railtie.rb
loaf-0.7.0 lib/loaf/railtie.rb
loaf-0.6.2 lib/loaf/railtie.rb
loaf-0.6.1 lib/loaf/railtie.rb
loaf-0.6.0 lib/loaf/railtie.rb