【问题标题】:Issues installing NUBIC/surveyor gem in Rails 3.2.3在 Rails 3.2.3 中安装 NUBIC/surveyor gem 的问题
【发布时间】:2013-04-16 03:44:10
【问题描述】:

我正在尝试在 Rails 3.2.3 应用程序中安装 NUBIC surveyor gem。我做了以下步骤:

1) 创建了一个新的 Rails 3.2.3 项目

 $ rails new surveyor

2) 添加了测量员宝石

 gem "surveyor"

3) 跑

bundle install

4) 生成资产

 script/rails generate surveyor:install

5) 运行迁移

 bundle exec rake db:migrate

6) 然后当我尝试“厨房水槽”调查时

 rake surveyor FILE=surveys/kitchen_sink_survey.rb

我遇到了以下错误:

survey rake 中止!无法批量分配受保护的属性:title、reference_identifier

我发现这个issue on github (#302) 涉及受保护属性的大规模分配,似乎问题已关闭并且 gem 已更新。任何关于我做错了什么的想法都将不胜感激。

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 surveyor-gem


    【解决方案1】:

    正如瑞德所说,这不再是当前版本的测量员的问题。你可以试试bundle update surveyor,或者在你的 Gemfile 中指定一个更新版本的surveyor,例如

    gem 'surveyor', '~>1.3.0'
    

    您可能还需要运行bundle exec rake surveyor FILE=...

    【讨论】:

      【解决方案2】:

      1) 我需要在 Gemfile 中指定依赖的 gem,但我没有这样做。我只指定了测量员宝石。

       gem 'surveyor', :git => 'git://github.com/NUBIC/surveyor.git' 
       gem 'haml', '~> 3.1.3'
       gem 'sass'
       gem 'fastercsv', '~> 1.5.4'
       gem 'formtastic', '~> 1.2.4'
       gem 'uuidtools', '~> 2.1'
       gem 'mustache', '0.99.4'
       gem 'rabl', '~>0.6.6'
       gem 'rake', '0.9.2'
      

      2) 测量员所需的 rake 版本 (0.9.2) 与我正在运行的 (0.9.2.2) 不同,因此我需要在 surveyor README install instructions 中的所有 rake 命令之前添加 bundle exec

      【讨论】:

      • 供将来参考:当前版本的 Surveyor 不再需要这样做。
      猜你喜欢
      • 1970-01-01
      • 2012-05-18
      • 1970-01-01
      • 2023-03-10
      • 1970-01-01
      • 2013-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多