Skip to content

Commit

Permalink
Avoid loading routes if we are actually precompiling assets.
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Sep 22, 2011
1 parent e4902af commit f199557
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/devise/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Engine < ::Rails::Engine
end

# Force routes to be loaded if we are doing any eager load.
config.before_eager_load { |app| app.reload_routes! }
config.before_eager_load { |app| app.reload_routes! unless ENV["RAILS_ASSETS_PRECOMPILE"] }

initializer "devise.url_helpers" do
Devise.include_helpers(Devise::Controllers)
Expand Down

4 comments on commit f199557

@dodeja
Copy link

@dodeja dodeja commented on f199557 Sep 22, 2011

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would ENV be RAILS_ASSETS_PRECOMPILE? Shouldn't it be production or staging?

@bradleypriest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dodeja, ENV["RAILS_ASSETS_PRECOMPILE"] isn't querying the Rails environment, you get that from Rails.env.
This is giving us a way to skip the routes just for the rake task with shell variables. i.e. So you can run RAILS_ASSETS_PRECOMPILE=true rake assets:precompile

@jfeldstein
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does one set RAILS_ASSETS_PRECOMPILE during just the asset:precompile task?

@josevalim
Copy link
Contributor Author

@josevalim josevalim commented on f199557 Nov 1, 2011 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.