rails initializer fix #82

Merged
merged 1 commit into from Aug 18, 2012

Projects

None yet

5 participants

@jacquescrocker

I believe it needs to be app.config.assets instead of app.assets. It fails otherwise

If this is merged, you might want to push a new gem release asap as 0.7.0 seems broken on Rails 3.2

Thanks!

@tchak tchak merged commit 5fb4029 into emberjs:master Aug 18, 2012
@tchak tchak added a commit that referenced this pull request Aug 18, 2012
@tchak tchak Revert "Merge pull request #82 from railsjedi/master"
This reverts commit 5fb4029, reversing
changes made to cabe8f5.
3a9e902
@tchak
Ember.js member

Seem legit, but it actually not working. Can you provide more informations on the issue?

@doxavore

I see this same thing running Rails 3.2.8 on JRuby 1.6.7.2. Applying this patch fixes it.

Here's a slightly ugly backtrace with JRuby "goodness":

require %q(org/torquebox/web/rails/boot)
: org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `register_engine' for nil:NilClass
    at (Anonymous).Engine(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/ember-rails-0.7.0/lib/ember/rails/engine.rb:18)  at org.jruby.RubyBasicObject.instance_exec(org/jruby/RubyBasicObject.java:1757) [jruby.jar:]
    at Rails::Initializable::Initializer.run(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30) at (Anonymous).run_initializers(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55)  at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615) [jruby.jar:]
    at Initializable.run_initializers(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54)    at Application.initialize!(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136)    at Class.method_added(file:/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/torquebox-server-2.1.0-java/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:90) at org.jruby.RubyBasicObject.__send__(org/jruby/RubyBasicObject.java:1698) [jruby.jar:]
    at org.jruby.RubyKernel.send(org/jruby/RubyKernel.java:2097) [jruby.jar:]
    at ClassMethods.method_missing(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30)    at (Anonymous).(root)(/Users/doug/projects/myapp/config/environment.rb:5)   at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1068) [jruby.jar:]
    at (Anonymous).(root)(/Users/doug/projects/myapp/config/environment.rb:110) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1042) [jruby.jar:]
    at (Anonymous).(root)(file:/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/torquebox-server-2.1.0-java/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:3)
13:02:12,086 ERROR [org.torquebox.core.runtime] (Thread-117) Failed to initialize runtime: : org.jruby.exceptions.RaiseException: (NoMethodError) undefined method `register_engine' for nil:NilClass
    at (Anonymous).Engine(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/ember-rails-0.7.0/lib/ember/rails/engine.rb:18)  at org.jruby.RubyBasicObject.instance_exec(org/jruby/RubyBasicObject.java:1757) [jruby.jar:]
    at Rails::Initializable::Initializer.run(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:30) at (Anonymous).run_initializers(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:55)  at org.jruby.RubyArray.each(org/jruby/RubyArray.java:1615) [jruby.jar:]
    at Initializable.run_initializers(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/initializable.rb:54)    at Application.initialize!(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/application.rb:136)    at Class.method_added(file:/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/torquebox-server-2.1.0-java/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:90) at org.jruby.RubyBasicObject.__send__(org/jruby/RubyBasicObject.java:1698) [jruby.jar:]
    at org.jruby.RubyKernel.send(org/jruby/RubyKernel.java:2097) [jruby.jar:]
    at ClassMethods.method_missing(/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/railties-3.2.8/lib/rails/railtie/configurable.rb:30)    at (Anonymous).(root)(/Users/doug/projects/myapp/config/environment.rb:5)   at org.jruby.RubyKernel.load(org/jruby/RubyKernel.java:1068) [jruby.jar:]
    at (Anonymous).(root)(/Users/doug/projects/myapp/config/environment.rb:110) at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1042) [jruby.jar:]
    at (Anonymous).(root)(file:/Users/doug/.rbenv/versions/jruby-1.6.7.2/lib/ruby/gems/1.8/gems/torquebox-server-2.1.0-java/jboss/modules/org/torquebox/web/main/torquebox-web.jar!/org/torquebox/web/rails/boot.rb:3)
@doxavore

Just to add a little more info on this - I moved ember-rails further down my Gemfile and it has started working now. I'm not sure what it has to come after, or at what point app.assets is available instead of app.config.assets, but I'd imagine that means we're missing some kind of require somewhere?

@te-chris

I got this error and moved it below jquery-rails and less-rails then it worked (in my Gemfile). Very weird.

@aew
aew commented Nov 2, 2012

I'm struggling with this issue now...things work in my dev environment but crash when pushed to Heroku. I've moved ember-rails gem 0.8.0 to the bottom of the Gemfile with no luck.

My gemfile:

source 'https://rubygems.org'

gem 'rails', '3.2.8'
gem 'jquery-rails'
gem "mongoid", "~> 3.0.0"
gem "mongo"
gem "bson_ext" # commented for JRuby
gem 'devise'
gem 'simple_form'
gem 'haml-rails'
gem 'active_model_serializers'
gem 'puma'
group :assets do
gem 'coffee-rails'
gem 'twitter-bootstrap-rails'
gem 'uglifier'
end
gem 'ember-rails'

Heroku log:

2012-11-02T17:08:38+00:00 heroku[web.1]: Starting process with command bundle exec rails server puma -p 29029 -e production
2012-11-02T17:08:46+00:00 app[web.1]: => Call with -d to detach
2012-11-02T17:08:46+00:00 app[web.1]: => Booting Puma
2012-11-02T17:08:46+00:00 app[web.1]: => Rails 3.2.8 application starting in production on http://0.0.0.0:29029
2012-11-02T17:08:46+00:00 app[web.1]: => Ctrl-C to shutdown server
2012-11-02T17:08:46+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /app/config/environment.rb:5)
2012-11-02T17:08:46+00:00 app[web.1]: DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from at /app/config/environment.rb:5)
2012-11-02T17:08:47+00:00 app[web.1]: /app/vendor/bundle/ruby/1.9.1/gems/ember-rails-0.8.0/lib/ember/rails/engine.rb:17:in block in <class:Engine>': undefined methodregister_engine' for nil:NilClass (NoMethodError)
2012-11-02T17:08:47+00:00 app[web.1]: Exiting

EDIT: My issue appears to be related to the twitter-bootstrap-rails gem, which must come before ember-rails and which must be version 2.1.5 (not version 2.1.6). Still, seems too fragile if twitter bootstrap can break something in the ember-rails initializer...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment