Permalink
Browse files

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.
  • Loading branch information...
1 parent 3fb5adc commit edfeb9f67f77b4fbb8145c5d9f77dd5addca6592 @weppos committed Dec 21, 2010
View
@@ -1 +1 @@
-require "tabs_on_rails"
+require 'tabs_on_rails'
View
@@ -14,10 +14,10 @@
#++
-require 'tabs_on_rails/controller_mixin'
require 'tabs_on_rails/tabs'
require 'tabs_on_rails/version'
-
+require 'tabs_on_rails/action_controller'
+require 'tabs_on_rails/railtie'
module TabsOnRails
@@ -16,7 +16,7 @@
module TabsOnRails
- module ControllerMixin
+ module ActionController
def self.included(base)
base.extend ClassMethods
@@ -13,16 +13,26 @@
#
#++
-require 'tabs_on_rails'
module TabsOnRails
- class Railtie < ::Rails::Railtie
- initializer "tabs_on_rails.initialize" do
- ActiveSupport.on_load :action_controller do
- ActionController::Base.send :include, TabsOnRails::ControllerMixin
- end
+ 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
@@ -17,7 +17,6 @@
require 'tabs_on_rails/tabs/builder'
require 'tabs_on_rails/tabs/tabs_builder'
-
module TabsOnRails
class Tabs
@@ -193,7 +193,7 @@ def test_current_tab_question
class ControllerMixinHelpersTest < ActionView::TestCase
- tests TabsOnRails::ControllerMixin::HelperMethods
+ tests TabsOnRails::ActionController::HelperMethods
include ActionView::Helpers::TagHelper
include ActionView::Helpers::UrlHelper
@@ -1,7 +1,7 @@
require 'test_helper'
class TabsBuilderTest < ActionView::TestCase
- tests TabsOnRails::ControllerMixin::HelperMethods
+ tests TabsOnRails::ActionController::HelperMethods
include ActionView::Helpers::TagHelper
include ActionView::Helpers::UrlHelper
View
@@ -22,7 +22,6 @@
end
ActionController::Base.send :include, TabsOnRails::Routes.url_helpers
-ActionController::Base.send :include, TabsOnRails::ControllerMixin
class ActiveSupport::TestCase
setup do

0 comments on commit edfeb9f

Please sign in to comment.