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

Commit e2584da

Browse files
committed
Fix Rails 4.1.0 issues correctly
1 parent 9a3eb2a commit e2584da

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/requirejs/rails/config.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,16 @@ module Requirejs::Rails
99
class Config < ::ActiveSupport::OrderedOptions
1010
LOADERS = [ :requirejs, :almond ]
1111

12-
def initialize
12+
def initialize(application)
1313
super
1414
self.manifest = nil
1515

1616
self.logical_asset_filter = [/\.js$/,/\.html$/,/\.txt$/]
17-
self.tmp_dir = Rails.root + 'tmp'
17+
self.tmp_dir = application.root + 'tmp'
1818
self.bin_dir = Pathname.new(__FILE__+'/../../../../bin').cleanpath
1919

2020
self.source_dir = self.tmp_dir + 'assets'
21-
self.target_dir = Rails.root + 'public/assets'
21+
self.target_dir = application.root + 'public/assets'
2222
self.rjs_path = self.bin_dir+'r.js'
2323

2424
self.loader = :requirejs

lib/requirejs/rails/engine.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ module Requirejs
66
module Rails
77
class Engine < ::Rails::Engine
88
### Configuration setup
9+
config.before_configuration do |app|
10+
config.requirejs = Requirejs::Rails::Config.new(app)
11+
config.requirejs.precompile = [/require\.js$/]
12+
end
13+
914
config.before_initialize do |app|
1015
config = app.config
1116

12-
config.requirejs = Requirejs::Rails::Config.new
13-
config.requirejs.precompile = [/require\.js$/]
14-
1517
# Process the user config file in #before_initalization (instead of #before_configuration) so that
1618
# environment-specific configuration can be injected into the user configuration file
1719
Engine.process_user_config_file(app, config)

0 commit comments

Comments
 (0)