Wednesday, March 7, 2012

Issues encountered when upgrading from rails 3.0.11 to 3.1.7

Here are a few things I encountered when making the upgrade.

Once I had changed the entry in gemfile to gem rails '3.1.7' and performed a 'bundle update rails', I ran a single cucumber feature, and got the following error:

/Users/user/.rvm/gems/ruby-1.9.2-p290@givecorps_rails_3_1/gems/activerecord-3.1.4/lib/active_record/attribute_methods/read.rb:91: syntax error, unexpected keyword_end
  /Users/user/.rvm/gems/ruby-1.9.2-p290@givecorps_rails_3_1/gems/activerecord-3.1.4/lib/active_record/attribute_methods/read.rb:93: syntax error, unexpected $end, expecting keyword_end (SyntaxError)
  ./features/step_definitions/model_steps.rb:9:in `block in build_models_from_table'
  ./features/step_definitions/model_steps.rb:8:in `each'
  ./features/step_definitions/model_steps.rb:8:in `build_models_from_table'
  ./features/step_definitions/model_steps.rb:17:in `/^the following ([^"]*):$/'
  features/admin_assigns_categories_to_causes.feature:8:in `Given the following cause:'

It turns out, this was caused by incompatibilities between rails 3.1 and the mysql2 gem. So I modified the gemfile with gem mysql2 '~> 0.3', and ran bundle update mysql2.

Running the feature again, I got:

Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (can't activate mysql2 (~> 0.3.10), already activated mysql2-0.3.7. Make sure all dependencies are added to Gemfile.) (RuntimeError)

It turns out, when I had first run bundler to update mysql2, version 0.3.7 was installed. Rerunning bundler install got version 0.3.11, and the mysql2 adapter issue went away, and the feature ran.

I then started the server, and got the following error:

undefined method `debug_rjs=' for ActionView::Base:Class (NoMethodError)

I had to remove from development.rb the following:

config.action_view.debug_rjs             = true

I was then able to start the server.

Hitting the first page, however, I got the following error:

NoMethodError (undefined method `each' for nil:NilClass):
  

 Rendered /Users/user/.rvm/gems/ruby-1.9.2-p290@givecorps_rails_3_1/gems/actionpack-3.1.4/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.0ms)
 Rendered /Users/user/.rvm/gems/ruby-1.9.2-p290@givecorps_rails_3_1/gems/actionpack-3.1.4/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (18.0ms)
 Rendered /Users/user/.rvm/gems/ruby-1.9.2-p290@givecorps_rails_3_1/gems/actionpack-3.1.4/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (22.0ms)

This led to a discussion on rails and rack about ill-formed cookies that as of today, does not seem to be resolved.

So I cleared my browsers cookies, and was able to view the site. Hopefully, this won't be an issue on the production server.

Browsing the site, I got the following error:
undefined method `paginate' for #

I had updated to the rails 3 version of will_paginate. This required me to modify the syntax used in calling paginate, and to include the 'paginate/array' module since some of what I paginate are returned arrays (mostly to ensure uniqueness)

No comments:

Post a Comment