Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for Rails 4 #120

Merged
merged 2 commits into from Jan 24, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/simple_navigation/adapters/rails.rb
Expand Up @@ -49,15 +49,15 @@ def content_tag(type, content, options={})
protected protected


def self.rails_root def self.rails_root
rails3? ? ::Rails.root : ::RAILS_ROOT gte_rails3? ? ::Rails.root : ::RAILS_ROOT
end end


def self.rails_env def self.rails_env
rails3? ? ::Rails.env : ::RAILS_ENV gte_rails3? ? ::Rails.env : ::RAILS_ENV
end end


def self.rails3? def self.gte_rails3?
::Rails::VERSION::MAJOR == 3 ::Rails::VERSION::MAJOR >= 3
end end


def template_from(controller) def template_from(controller)
Expand All @@ -82,7 +82,7 @@ def extract_controller_from(context)
end end


# Initializer for Rails3 # Initializer for Rails3
if defined?(Rails) && Rails::VERSION::MAJOR == 3 if defined?(Rails) && SimpleNavigation::Adapters::Rails.gte_rails3?
module SimpleNavigation module SimpleNavigation
class Railtie < Rails::Railtie class Railtie < Rails::Railtie
initializer "simple_navigation.register" do |app| initializer "simple_navigation.register" do |app|
Expand Down