railsware / smt_rails

Shared mustache templates for rails 3.
http://blog.railsware.com/2012/04/12/shared-mustache-templates-for-rails-3/
MIT License
109 stars 21 forks source link

`method_missing': undefined method `assets' in Rails 3.2.22 #16

Closed marianomms closed 8 years ago

marianomms commented 8 years ago

I was using Rails 3.2.22 with smt_rails 0.2.7 and all was fine.

I updated to smt_rails 0.2.8 and I'm getting this error when I try to run the app:

/Users/xxxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `assets' for #<Rails::Engine::Configuration:0x007fbd08464c00> (NoMethodError)
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/smt_rails-0.2.8/lib/smt_rails/engine.rb:9:in `block in <class:Engine>'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/initializable.rb:30:in `run'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/initializable.rb:54:in `each'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/application.rb:136:in `initialize!'
    from /Users/xxx/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.22.2/lib/rails/railtie/configurable.rb:30:in `method_missing'

maybe this change could be:

    initializer "sprockets.smt_rails", :group => :all do |app|
      app.config.assets.configure do |env|
        env.register_engine(".#{SmtRails.template_extension}", Tilt)
      end
      app.config.assets.paths << SmtRails.template_base_path
    end

Thanks

le0pard commented 8 years ago

Looks like it was broken by this https://github.com/railsware/smt_rails/pull/15/files PR. If you have time - you can send me PR, which will fix this.

marianomms commented 8 years ago

17 done :wink: