Skip to content

Commit e91b8ee

Browse files
authored
Merge pull request heartcombo#5055 from saiqulhaq/master
refactor method name to be more consistent
2 parents eced9b0 + 0d56ae2 commit e91b8ee

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

lib/devise/failure_app.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def scope_url
153153
# We need to add the rootpath to `script_name` manually for applications that use a Rails
154154
# version lower than 5.1. Otherwise, it is going to generate a wrong path for Engines
155155
# that use Devise. Remove it when the support of Rails 5.0 is droped.
156-
elsif root_path_defined?(context) && rails_5_and_down?
156+
elsif root_path_defined?(context) && !rails_51_and_up?
157157
rootpath = context.routes.url_helpers.root_path
158158
opts[:script_name] = rootpath.chomp('/') if rootpath.length > 1
159159
end
@@ -278,14 +278,8 @@ def root_path_defined?(context)
278278
defined?(context.routes) && context.routes.url_helpers.respond_to?(:root_path)
279279
end
280280

281-
def rails_5_and_down?
282-
return false if rails_5_up?
283-
284-
Rails::VERSION::MAJOR >= 4
285-
end
286-
287-
def rails_5_up?
288-
Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR > 0
281+
def rails_51_and_up?
282+
Rails::VERSION::MAJOR >= 5 && Rails::VERSION::MINOR >= 1
289283
end
290284
end
291285
end

0 commit comments

Comments
 (0)