Rails railties gem错误“未定义的方法:'少'" [英] Rails railties gem error "undefined method: 'less'"

查看:36
本文介绍了Rails railties gem错误“未定义的方法:'少'"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近用 gem updatebundle update 更新了我的 rails 应用程序的 gem.当我尝试用 rails s 测试它时,它给了我这个错误:

I've just recently updated my rails app's gems with gem update and bundle update. When I tried to test it out with rails s it gives me this error:

/Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configuration.rb:85:inmethod_missing': undefined method less' for #<Rails::Application::Configuration:0x0000010308a300>(NoMethodError)

/Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configuration.rb:85:inmethod_missing': undefined method less' for #<Rails::Application::Configuration:0x0000010308a300> (NoMethodError)

错误信息的其余部分是这样的:

The rest of the error message goes like this:

from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/twitter-bootstrap-rails-2.1.6/lib/twitter/bootstrap/rails/engine.rb:15:in `block in <class:Engine>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:30:in `run'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `each'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/application.rb:136:in `initialize!'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/Richard/Code/Rails/rgsimms/config/environment.rb:5:in `<top (required)>'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:4:in `require'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:4:in `block in <main>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:51:in `initialize'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:1:in `new'
    from /Users/Richard/Code/Rails/rgsimms/config.ru:1:in `<main>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:40:in `eval'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/builder.rb:40:in `parse_file'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/server.rb:200:in `app'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/server.rb:46:in `app'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/rack-1.4.1/lib/rack/server.rb:252:in `start'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands/server.rb:70:in `start'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:50:in `tap'
    from /Users/Richard/.rvm/gems/ruby-1.9.2-p318/gems/railties-3.2.3/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

这是 Twitter Bootstrap gem 的错误吗?我还在学习,所以我该如何解决这个问题?任何帮助都很棒.

Is this an error with the Twitter Bootstrap gem? I'm still learning so how would I get this fixed? Any help is awesome.

推荐答案

twitter bootstrap gem 依赖于 less gem.来自 文档:

The twitter bootstrap gem depends on the less gem. From the docs:

gem "therubyracer"
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
gem "twitter-bootstrap-rails"

我个人发现 twitter bootstrap 更容易从官方网站转储文件进入供应商/资产目录.从 gem 更新比手动更新要容易一些,但是在更新引导程序时,您有点想手动"进行更新.并通过眼睛"检查所有内容无论如何 - 我更喜欢额外的努力,以确保它不会轻易完成.此外,很难从宝石中去除某些(例如)响应部分,而没有(据我所知)未指定"的部分.样式.响应式内容从版本到版本在大小方面都会发生变化,因此您不能仅仅依靠它来工作.我真的看不出使用 gem 有什么好处.

I've personally found it easier for twitter bootstrap to just dump the files from the official site into the vendor/assets directory. Updating from the gem is marginally easier than by hand, but when updating bootstrap, you kind of want to do it "by hand" and check it all out "by eye" anyway - I prefer the extra effort, to ensure it does not get done lightly. Also, it is very hard to remove certain (for example) responsive portions from the gem, without (as far as I could tell) "unspecifying" the styles. The responsive stuff changes, from version to version, in terms of size, so you can't just rely on it all working. I really can't see any advantage to using the gem.

更新

现在有一个官方 gem,我建议您查看:https://github.com/twbs/bootstrap-sass

There is now an official gem for this, which I recommend checking out: https://github.com/twbs/bootstrap-sass

这篇关于Rails railties gem错误“未定义的方法:'少'"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆