leshill / handlebars_assets

Use handlebars.js templates with the Rails asset pipeline.
MIT License
647 stars 159 forks source link

Fixes a bug that was preventing Rails app startup #151

Closed disbelief closed 8 years ago

disbelief commented 8 years ago

Error was:

'method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x007fca48b60e58> (NoMethodError)
from handlebars_assets/lib/handlebars_assets/engine.rb:5:in 'block in <class:Engine>'

Seems to be a simple logic error here:

class Engine < ::Rails::Engine
    initializer "handlebars_assets.assets.register", :group => :all do |app|
      config.assets.configure do |sprockets_env|
      # ...
    end
end

Note that config does not exist here, however app.config does. Changing to that fixes the problem.

Surprised no one else has encountered this as it completely prevented my Rails app from starting.

AlexRiedler commented 8 years ago

@disbelief I think this might be true only for a specific version of rails ... hmm; what version of rails is this on ?

disbelief commented 8 years ago

@AlexRiedler ah yeah maybe this is true. It was happening to me on Rails 3.2

AlexRiedler commented 8 years ago

I think this change is harmless; I will do some testing tomorrow and have a patch fix tomorrow

bcavileer commented 8 years ago

Bump.

Can we please get this merged?

changing config.assets to app.config.assets is compatible with Rails 3 and Rails 4.

This is how other gems are doing it: https://github.com/railsware/smt_rails/commit/13c526af2b1b6acc7f41131226f536be8e65a49e

AlexRiedler commented 8 years ago

Release 0.23.1 with this fix; sorry about how long this took. Lost it in the dread of emails. Thanks for pinging @bcavileer

PikachuEXE commented 8 years ago

It seem the commit & tag for 0.23.1 are not on GitHub Can you push them? Thanks

Oh I think change log should also updated too.

AlexRiedler commented 8 years ago

Changelog was updated; I forgot to push tag though. Thanks, tagged.