Skip to content
This repository has been archived by the owner on Mar 23, 2024. It is now read-only.

Fix compatibility with Rails 3 #271

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions lib/requirejs/rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,16 @@ class Engine < ::Rails::Engine

# Are we running in the precompilation Rake task? If so, we need to adjust certain environmental configuration
# values.
if defined?(Rake) && Rake.application.top_level_tasks.include?("requirejs:precompile:all")
if defined?(Rake) && defined?(Rake.application) && Rake.application.top_level_tasks.include?("requirejs:precompile:all")
initializer "requirejs.modify_environment_config", after: "load_environment_config", group: :all do |app|
app.configure do
# If we don't set this to true, sprockets-rails will assign `Rails.application.assets` to `nil`.
config.assets.compile = true
# If we don't set this to true, sprockets-rails will assign `Rails.application.assets` to `nil`.
app.config.assets.compile = true

# Don't compress JavaScripts fed into the r.js optimizer.
config.assets.js_compressor = false
# Don't compress JavaScripts fed into the r.js optimizer.
app.config.assets.js_compressor = false

# Don't use any cache to retrieve assets.
config.assets.cache = nil
end
# Don't use any cache to retrieve assets.
app.config.assets.cache = nil
end
end

Expand Down