Search code examples
ruby-on-railsruby-on-rails-3surveyor-gem

Issues installing NUBIC/surveyor gem in Rails 3.2.3


I am trying to install the NUBIC surveyor gem in a Rails 3.2.3 app. I did the following steps:

1) Created a new Rails 3.2.3 project

 $ rails new surveyor

2) Added the surveyor gem

 gem "surveyor"

3) Ran

bundle install

4) Generated the assets

 script/rails generate surveyor:install

5) Ran migrations

 bundle exec rake db:migrate

6) Then when I tried the "kitchen sink" survey

 rake surveyor FILE=surveys/kitchen_sink_survey.rb

I encountered the following error:

survey rake aborted! Can't mass-assign protected attributes: title, reference_identifier

I found this issue on github (#302) regarding the mass-assignment of protected attributes and it seems as if the issue was closed and the gem was updated. Any ideas on what I am doing wrong would be greatly appreciated.


Solution

  • 1) I needed to specify the dependent gems in the Gemfile, which I hadn't done. I had only specified the surveyor 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) The rake version required by surveyor (0.9.2) was different than what I was running (0.9.2.2) so I needed to add bundle exec before all of the rake commands in the surveyor README install instructions.