Watched the railscast for upgrading: http://railscasts.com/episodes/282-upgrading-to-rails-3-1 Which instructed me to follow these steps:
- Change Gemfile rails version to 3.0.10
- bundle update
- make sure it still works
- Change Gemfile rails version to 3.1.0
- Comment out line in development.rb: config.action_view.debug_rjs
- bundle update
- make sure it still works
This is where I got my first issue. It said the mysql2 gem was too old (mine was < 0.3). I change the Gemfile to use the newest version and ran 'bundle update' again.
Then there was another issue related to the mysql2 bundle pointing to the correct library. This is a common issue running on OS X I guess. Here's the fix and the link where I got it: http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails/
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.7/lib/mysql2/mysql2.bundle
At this point I can run the app as normal locally. The next step was to push to heroku. I created a separate heroku location in case I ran into issues or if they used a different stack for 3.1 vs 3.0.x. I'll skip those steps. The error I got when I pushed was: `rescue in establish_connection': Please install the postgresql adapter: `gem install activerecord-postgresql-adapter` (pg is not part of the bundle. Add it to Gemfile.) (RuntimeError)
Unbeknownst to me, heroku actually uses postgress and not mysql. I guess it just worked before. I didn't really want to change my local stuff if I didn't need to so I found a solution here: http://stackoverflow.com/questions/6410623/heroku-error-when-launch-rails3-1-app-missing-postgres-gem
The actual fix was to just add the below to the Gemfile and run bundle with the '--without production' flag:
group :production do
gem 'pg'
end
After that pushing to heroku worked fine.
P.S. I must have run heroku db:migrate at some point, but I can't remember when. I think it was before I got the postgress error.
No comments:
Post a Comment