Skip to content

Commit

Permalink
Don't add devise routes if running DB rake tasks.
Browse files Browse the repository at this point in the history
  • Loading branch information
eugenk committed Sep 1, 2017
1 parent 03afb47 commit d447d10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT

GIT
remote: git://github.com/ontohub/ontohub-models.git
revision: 5c43e364fd84c2022361f72e44cceb4a126e0eb7
revision: a4c8d67e63bdd02d14a4cfb9a118ada143b41f22
branch: master
specs:
ontohub-models (0.1.0)
Expand Down
10 changes: 8 additions & 2 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,14 @@ def allow_double_slashes_in_routes
allow_double_slashes_in_routes do
scope format: false, defaults: {format: :json} do
# Add mappings for Devise, but skip all Devise-routes
devise_for :users,
skip: %i(registrations confirmations sessions unlocks passwords)
# We exclude these Devise mappings from these rake tasks because they
# load the models. When loading the models, the database needs to exist,
# or else it throws an error.
unless rake_task?(%w(db:create db:migrate db:drop
db:recreate db:recreate:seed))
devise_for :users,
skip: %i(registrations confirmations sessions unlocks passwords)
end

# Add routes to a no-op action to create URL-helpers that are used in
# confirmation, password-reset and unlock emails
Expand Down

0 comments on commit d447d10

Please sign in to comment.