#
# = Tabs on Rails
#
# A simple Ruby on Rails plugin for creating and managing Tabs.
#
#
# Category::    Rails
# Package::     TabsOnRails
# Author::      Simone Carletti <weppos@weppos.net>
# License::     MIT License
#
#--
#
#++


module TabsOnRails

  if defined? Rails::Railtie
    class Railtie < ::Rails::Railtie
      # initializer "tabs_on_rails.initialize" do
      #   ActiveSupport.on_load :action_controller do
      #     ::ActionController::Base.send :include, TabsOnRails::ActionController
      #   end
      # end
    end
  end

end

require "active_support"
require "action_controller"

# There should be a better way to do this!
# I can't rely on Railtie#initializer because TabsOnRails::ActionController
# provides class methods which should be available when the class
# is evaluated.
ActionController::Base.send :include, TabsOnRails::ActionController

#
# = Tabs on Rails
#
# A simple Ruby on Rails plugin for creating and managing Tabs.
#
#
# Category::    Rails
# Package::     TabsOnRails
# Author::      Simone Carletti <weppos@weppos.net>
# License::     MIT License
#
#--
#
#++


module TabsOnRails

  class Railtie < Rails::Railtie
    initializer "tabs_on_rails.initialize" do
    end
  end

end

ActiveSupport.on_load(:action_controller) do
  include TabsOnRails::ActionController
end

Move on_load outside the block because in tests the :on_load doesn't seem to be correctly triggered.
Move on_load outside the block because in tests the :on_load doesn't seem to be correctly triggered.

The other alternative is to trigger the event manually, like several libraries do.

E.g. https://github.com/voxdolo/decent_exposure/blob/master/spec/lib/rails_integration_spec.rb