当我尝试在我的终端中运行rails g bootstrap:主题关联时会发生这种情况:
C:/Users/ruby/.pik/rubies/Ruby-193-p327/lib/ruby/gems/1.9.1/gems/twitter-bootstrap-rails-2.1.9/lib/generators/bootstrap/themed/themed_generator.rb:87:in `block in retrieve_columns': undefined method `columns' for Association:Class (NoMethodError)
解决方法
我刚刚得到完全相同的错误.我创建了两个相同的项目 – 一个有mongoid,一个没有.我只得到mongoid项目的错误.
删除文件中对ActiveRecord的引用(在第87行附近):
/home/ubuntu/.rvm/gems/ruby-1.9.3-p327/bundler/gems/twitter-bootstrap-rails-b8b7eb22614a/lib/generators/bootstrap/themed/themed_generator.rb
我变了 …
def retrieve_columns if defined?(ActiveRecord) rescue_block ActiveRecord::StatementInvalid do @model_name.constantize.columns end else rescue_block do @model_name.constantize.fields.map {|c| c[1] } end end end
对…
def retrieve_columns rescue_block do @model_name.constantize.fields.map {|c| c[1] } end end
为了使视图正常工作,我需要确保我的模型类有一个不是nil的created_at字段(或者编辑生成的视图).
希望这可以帮助.
PS:哇……好像你在windows上有twitter-bootstrap-rails工作 – 我不知道这是可能的!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。