decioferreira / bootstrap-generators

Bootstrap-generators provides Twitter Bootstrap generators for Rails
MIT License
353 stars 77 forks source link

undefined method `root' for Bootstrap::Rails:Module #21

Closed fotanus closed 10 years ago

fotanus commented 10 years ago

I'm using Ruby 2.1, Rails 4.0.2

Running the generate bootstrap:install throws an error, as described bellow:

rails generate bootstrap:install -f
/home/fotanus/.rvm/gems/ruby-2.1.0/gems/bootstrap-generators-3.0.2/lib/bootstrap-generators.rb:12:in `block in <class:Engine>': undefined method `root' for Bootstrap::Rails:Module (NoMethodError)
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:30:in `run'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:226:in `block in tsort_each'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:427:in `each_strongly_connected_component_from'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `call'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:345:in `each_strongly_connected_component'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:224:in `tsort_each'
    from /home/fotanus/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/tsort.rb:205:in `tsort_each'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:215:in `initialize!'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /home/fotanus/code/wordpress_manager/config/environment.rb:5:in `<top (required)>'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/application.rb:189:in `require_environment!'
    from /home/fotanus/.rvm/gems/ruby-2.1.0/gems/railties-4.0.2/lib/rails/commands.rb:44:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

I'm not quite sure why the error is happening, the offended line seems correct:

app.config.assets.paths << Rails.root.join('app', 'assets', 'fonts')

Simply commenting it would not add the fonts to the path, and the command works.

decioferreira commented 10 years ago

Can you just try changing the line? To:

app.config.assets.paths << ::Rails.root.join('app', 'assets', 'fonts')

Ensuring that we're looking in the root/global namespace instead of within your current module. Thanks.

fotanus commented 10 years ago

Hi,

Yes, you are correct. Works this way.

Regards, Felipe

decioferreira commented 10 years ago

Thanks. I will fix it and release a new version ASAP.

decioferreira commented 10 years ago

Just pushed a new version of the gem 3.0.2.1. You can now update the gem. Let me know if you have any other issue.

fotanus commented 10 years ago

Hi,

I think that everything else works fine, thank you for the great work.

On Mon, Jan 20, 2014 at 9:03 AM, Décio Ferreira notifications@github.comwrote:

Just pushed a new version of the gem 3.0.2.1. You can now update the gem. Let me know if you have any other issue.

— Reply to this email directly or view it on GitHubhttps://github.com/decioferreira/bootstrap-generators/issues/21#issuecomment-32750602 .

Felipe Tanus