Skip to content
This repository
Browse code

Merge pull request #120 from smasry/master

Adding support for Rails 4
  • Loading branch information...
commit 2779687167509eff524b9796a20f828a4c8cc169 2 parents 79ea081 + c7f1af0
Andi Schacke authored January 24, 2013

Showing 1 changed file with 5 additions and 5 deletions. Show diff stats Hide diff stats

  1. 10  lib/simple_navigation/adapters/rails.rb
10  lib/simple_navigation/adapters/rails.rb
@@ -49,15 +49,15 @@ def content_tag(type, content, options={})
49 49
       protected
50 50
       
51 51
       def self.rails_root
52  
-        rails3? ? ::Rails.root : ::RAILS_ROOT
  52
+        gte_rails3? ? ::Rails.root : ::RAILS_ROOT
53 53
       end
54 54
       
55 55
       def self.rails_env
56  
-        rails3? ? ::Rails.env : ::RAILS_ENV
  56
+        gte_rails3? ? ::Rails.env : ::RAILS_ENV
57 57
       end
58 58
       
59  
-      def self.rails3?
60  
-        ::Rails::VERSION::MAJOR == 3
  59
+      def self.gte_rails3?
  60
+        ::Rails::VERSION::MAJOR >= 3
61 61
       end
62 62
       
63 63
       def template_from(controller)
@@ -82,7 +82,7 @@ def extract_controller_from(context)
82 82
 end
83 83
 
84 84
 # Initializer for Rails3
85  
-if defined?(Rails) && Rails::VERSION::MAJOR == 3
  85
+if defined?(Rails) && SimpleNavigation::Adapters::Rails.gte_rails3?
86 86
   module SimpleNavigation                                                                                                
87 87
     class Railtie < Rails::Railtie                                                                                       
88 88
       initializer "simple_navigation.register" do |app|                                                             

0 notes on commit 2779687

Please sign in to comment.
Something went wrong with that request. Please try again.