Upgrade to Rails 2.1.0_RC1
May 22nd, 2008 cpetersen
Today seemed like a good day for an upgrade, so I decided to update our app to Rails 2.1.0_RC1. (The real reason is, I wanted to use
has_one :through, but it wasn't in my version of Rails!)
I've detailed the steps I took to get our app up and running, this isn't an exhaustive list by any means, but I hope it helps.
Download Rails 2.1.0_RC1
Rail is on GitHub now, which is a great move. Unfortunately, our app is still under subversion and piston doesn't yet support Git, so I downloaded RC1 from http://github.com/rails/rails/commits/v2.1.0_RC1
Since I can't manage it with Piston anymore, I completely removed rails from my vendor directory and replaced it with the downloaded version.
Now its time to run
rake spec
and see where we are.
STATUS: Dead in the water
ActionView::Base to ActionView::Template
At this point I can't even run rake, I just get the following error:
ERROR
> rake spec
(in /Users/cpetersen/project)
rake aborted!
undefined method `register_template_handler' for ActionView::Base:Class
(See full trace by running task with --trace)
It turns out we are registering a template handler for PDFs in our environment. Looks like they moved that functionality out of ActionView::Base into ActionView::Template, to fix all we needed to do is change the following line your config/environment.rb:
1 2 |
ActionView::Base.register_template_handler 'pdf', ActionView::PDFRender |
1 2 |
ActionView::Template.register_template_handler 'pdf', ActionView::PDFRender |
STATUS: LOTS of errors, 706 failures in 1014 tests
will_paginate
We use the wonderful will_paginate plugin to handle pagination in our app. However, when I run my specs, I now get the following:
ERROR
705)
ActionView::TemplateError in 'CatalogController bin should show a compound'
stack level too deep
In catalog/compound.html.erb
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:138:in `method_missing_without_paginate'
vendor/plugins/will_paginate/lib/will_paginate/finder.rb:139:in `method_missing'
app/models/ware.rb:67:in `suggested_bins'
spec/models/bin_spec.rb:32
It turns out, we weren't on the latest release. You can get the latest release here. Once again, its from the hub. The same process I used for installing Rails from github applies here.
STATUS: fewer errors, 30 failures in 1014 tests
acts_as_versioned
Not bad, the tests run, and only about 3% are failing. What next?
Almost all of the remaining errors look like this one:
ERROR
30)
NoMethodError in '/survey_templates/edit should render survey template edit page'
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.include?
./spec/views/survey_templates/edit.html.erb_spec.rb:6:in `new'
./spec/views/survey_templates/edit.html.erb_spec.rb:6:
We are using the acts_as_versioned plugin for versioning a lot of our content.
It turns out the core team has done a lot of work on "dirty" objects for this release. Ryan Daigle does a good job explaining it. It turns out this functionality breaks acts_as_versioned.
Luckily for us, codafoo is able to help. He forked acts_as_versioned and made it work with RC1 and dirty objects. You can get his version here. Since I had frozen acts_as_versioned into my vendor/gems directory, I just had to replace it with codafoo's version. Your milage may vary.
You'll notice, its GitHub once again. Note to self, switch to git.
STATUS: almost there, 2 failures in 1014 tests
Proper has_one Validation
Now we are getting down to some nitty gritty errors. It turns out my last two errors were only working before by accident.
Prior to RC1, has_one relationships weren't being validated properly on save. I apparently had my fixtures in an inconsistent state, causing my test to fail. My fault, RC1 helped me find a problem with my fixtures. Here is the ticket. I fixed my fixtures, and on to the next/last.
STATUS: last one, 1 failure in 1014 tests
Minor ActiveRecord::Base.find Change
Finally, there was a change to ActiveRecord::Base.find. I have a has_many :through relationship and I am doing a non-trivial find. I was including the table order_states and referencing its order_status_id column in my conditions. However, I wasn't including the table name in my conditions. Here's the code:
1 2 |
@orders = Order.find(:all, :conditions => "order_status_id > 1", :include => "order_states", :order => "orders.created_at DESC") |
1 2 |
@orders = Order.find(:all, :conditions => "order_states.order_status_id > 1", :include => "order_states", :order => "orders.created_at DESC") |
STATUS: finished.
Thanks to Rob and Ryan for helping my through this process.
See you at RailsConf!
Update - attachment_fu
After I wrote this post, I realized that attachment_fu had stopped working (yet all the tests passed, troublesome). When I tried to upload something, I received the following stack trace:
NoMethodError (undefined method `after_attachment_saved_callback_chain' for #):
/vendor/rails/activerecord/lib/active_record/base.rb:1645:in `method_missing_without_paginate'
/vendor/plugins/will_paginate/lib/will_paginate/finder.rb:164:in `method_missing'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:272:in `send'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:272:in `run_callbacks'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:298:in `callback'
/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:377:in `after_process_attachment'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `send'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `evaluate_method'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:161:in `call'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:93:in `run'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `each'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `send'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:92:in `run'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:272:in `run_callbacks'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:298:in `callback'
/vendor/rails/activerecord/lib/active_record/callbacks.rb:208:in `create_or_update'
/vendor/rails/activerecord/lib/active_record/base.rb:2176:in `save_without_validation'
/vendor/rails/activerecord/lib/active_record/validations.rb:901:in `save_without_dirty'
/vendor/rails/activerecord/lib/active_record/dirty.rb:75:in `save_without_transactions'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save'
/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb:66:in `transaction'
/vendor/rails/activerecord/lib/active_record/transactions.rb:79:in `transaction'
/vendor/rails/activerecord/lib/active_record/transactions.rb:98:in `transaction'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save'
/vendor/rails/activerecord/lib/active_record/transactions.rb:118:in `rollback_active_record_state!'
/vendor/rails/activerecord/lib/active_record/transactions.rb:106:in `save'
/app/controllers/assets_controller.rb:54:in `create'
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `call'
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `respond_to'
/app/controllers/assets_controller.rb:53:in `create'
/vendor/rails/actionpack/lib/action_controller/base.rb:1161:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:1161:in `perform_action_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:580:in `call_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:601:in `run_before_filters'
/app/controllers/application.rb:17:in `set_current'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `send'
/vendor/rails/activesupport/lib/active_support/callbacks.rb:173:in `evaluate_method'
/vendor/rails/actionpack/lib/action_controller/filters.rb:395:in `call'
/vendor/rails/actionpack/lib/action_controller/filters.rb:598:in `run_before_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:578:in `call_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/usr/local/lib/ruby/1.8/benchmark.rb:293:in `measure'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/vendor/rails/actionpack/lib/action_controller/rescue.rb:201:in `perform_action_without_caching'
/vendor/rails/actionpack/lib/action_controller/caching/sql_cache.rb:13:in `perform_action'
The solution for us was just to update attachment_fu to trunk. Voila, everything started working again.



May 29th, 2008 at 02:31 PM Thanks for the post, saved us some time!
June 4th, 2008 at 12:21 PM By "update attachment_fu to trunk" do you mean running the following? script/plugin update attachment_fu I tried that and no changes came down and problem remained...
July 28th, 2008 at 10:43 AM Thanks for the post... especially the info about acts_as_versioned
October 17th, 2008 at 01:25 AM Ridiculous, an upgrade breaking a major component of a web app. Rails is good, but this sort of behavior is unacceptable.
November 14th, 2008 at 09:47 AM @Martin Jessop: I definitely agree! This sort of behaviour can be seen with ruby-gettext as well! Actual compatibility problems prevent me from upgrading, even though rails 2.1 is now the stable version.
November 14th, 2008 at 03:22 PM Having the same problem as Matthew... what do you mean by "update attachment_fu to trunk"? This problem is wracking my brain, I've been working for hours trying to get this fixed.
November 18th, 2008 at 06:43 PM updating attachment_fu to trunk can be done with the following: rm -rf vendor/plugins/attachment_fu/ script/plugin install git://github.com/technoweenie/attachment_fu.git
December 27th, 2008 at 07:35 PM qrsgltpwccamxgkywell, hi admin adn people nice forum indeed. how's life? hope it's introduce branch ;)
January 9th, 2009 at 08:22 AM bw interracial lesbians anilingus kinky hot sexy naked woman free interracial porn vids group sex videos sexy brunette teen fingering pussy mature asian pussy free mature porn movies two girl kissing nude celebrity sex doggie style female masturbation technique bukkake movies rough anal sex sexy lesbians sexy female legs amateur anal cock freak foreskin cum gay doggie style sexy legs stocking celebrity nude titty fucking gonorrhea pictures hardcore animal sex free cartoon porn videos dominatrix stories tiny titties anal sex photos feminization big cock teen addiction sample lesbian orgasm forced infantilism female orgasm stories shaved teen pussy black hairy vagina nude celebritys tips on masturbation exotic sheer lingerie nude babes sexy milf girl tongue kissing boy erections huge facial huge black pussy bdsm tgp asian doggie style naked moms mad thumbs blonde hairy pussy huge tit fuck huge gay dicks guys anal fingering girls big boobs at work boners free porn lesbian foursomes big huge black tit cunnilingus pics busty dusty soccer moms mom sexy black teen sex amateur straight guys doggie style hardcore sex videos guy making a girl queef fingering her pussy mature xxx mom fucks son fingering her pussy tight anus free ebony porn videos girl fingering girl cunnilingus techniques hardcore lesbian strap on sex lesbian hentai video britney spears vagina slip hot lesbian moms free midget sex free handjob movies porn lesbian huge dildo insertion anal sluts hot lesbians tongue kissing girl queef hot asian average size clitorises hot mom next door cuntry boner fingering female techniques friends hot moms milf seekers gay masturbation britney shot spear vagina hymen video free porn vids nude male model clitoris erection dogs licking pussy girl gone wild kissing free videos of girls fingering themselves handjob cumshot teen wet vagina interracial lesbians fucking big gay cock uncut foreskin galleries teen asian porn autofellatio dvd young girl fingering gay cum mom still spanks me teen girl fingering black blowjob hymen video footjobs naked hot girls lesbian sex making out hardcore bbw facesitting cuckold interracial movie shemale gods
January 27th, 2009 at 03:06 PM flights best flights cheapest airplane tickets flight travel flight airfares travel flights us flight departures dublin flights to prague flights to tickets cheap flight places of interest travel time flight airport london flights to dubai airports fly cheap cheap air ticket cheap air flight student airfare services airline ticket airline discount student ticket air cheapflight fly air fare last minute airfare last cheap airline ticket airline discount fares discount flight deal booking flights delta airlines flights air fare last minute airfare last london flights to ireland flights airline discount tickets air fare discounted airfare cheap airline ticket cheap cheapflights air flights airfair airfare airfare auction low cost airlines cheap discount airfare flights to europe international deals airlines flights airlines cheap air fare flight cheapest flights airfare discount air fare flights ticket cheap flights from tickets last minute flight last hot air balloon flights north west cheap air tickets discount flights from cheap charter flights company discount air fares discount minute flights london flight low air fare cheap airline minute airfares last minute airline flight student airfare international flights very cheap lowest airfare lowest airfares search flights cheapflights fares cheap travel flights discount cheep flights compare cheap last minute airfare cheap airplane tickets lowest airfare lowest airfares airfare com airfare deal airfare deals airline flight airline tickets cheapest charter flight charter flights cheap cheap airfare tickets dublin flights to prague flights to flight booking air cheapest airline roundtrip tickets fares airline flight airline airports fly cheap cheap air ticket flight tracker airline tickets cheap airlines tickets airline fare airline cheap air fare to las vegas cheap airline ticket cheap reduced airfare search cheapest international airfares airfare travel airfare travel tickets airline fare airline american airlines international airfares internet airline tickets cheap ticket cheap flight flights flights com flights bargain flights international flights from bodrum turkey one way airfare business class airfares airfare direct flights dirt cheap direct flights from dublin to petersburg to athens flights to miami flights amsterdam flights flights how to open an airfare online business airfare com airfare deal airfare deals international airfare discounted british airways world cargo airline reservations airline discounted flights flight fares book airplane flights flights airline reservation airfares inexpensive airline airfares ticket airfare direct flights dirt cheap air flight cheap air flights flight ticket minute flights london flight low air fare flights best flights airfare taxes air tickets added com cheap airfare tickets airline com airline international travel discount airfares minute airfares last minute airline california orlando flights flight to australian pink floyd, e center, floor tickets for sale budget flights business class way flights online airfare plane airfares cheap airfares cheap airline cheap discount airfare cheap cheap tickets austrian airways air fare air fare deals air fares cheap air tickets discount air canada flights last minute air fare last minute airfare last cheap flight ticket tickets cheap flight air fare discounted airfare airplane flight time distance airfare new airlines one cheap airfares cheap airline cheap air line tickets deals airlines flights airlines flights airline reservation cheap air fare tickets cheap flights from fares cheap flight cheap flights to prices flight ticket flight tickets flights from cheap flight departures from manchester uk domestic airfare domestic airline tickets cheapest flights to australia discount air fares discount tickets book flight flights cheap airline tickets international flights discounted flights flight fares to london compare flights cheep airlines tickets airfare business class airfares book a flight airline discount tickets flights best flights airline tickets airline cheapest airfares cheap flights from airfare direct flights dirt cheap cheap plane tickets air fare discounted airfare minute airfares last minute airline cheapest airfares to florida cheap last minute airfare air cheapflight fly cheap air fares airfare business class airfares