Mar 2005 06

Fix for running Tracks 1.01 under Rails 0.10.0

Rails 0.10.0 introduced a new—and very simple—method of re-writing URLs, which works with a variety of different servers, and means that the Rails app itself can be hold the re-writing rules, without having to mess about with .htaccess and the like.

However, it does require some changes to be made to Rails apps, and these aren’t present in Tracks 1.01. Needless to say, I’ve made the requisite changes to the next version which is in development (and they work really well!), but if you’ve got Rails 0.10.0 installed and want to use Tracks 1.01, you’ll have to make the following fix.

You need to force Tracks to use the previous versions of the gems before the Rails 0.10.0 update. If you’ve only installed one version of Rails, then you might have to uninstall it and install an earlier version.
gem install Rails -v 0.9.5

Otherwise, run gem list at the command line and take a look at the versions of all the required components prior to Rails 0.10.0. Then in tracks/config/environment.rb replace these lines:


require 'rubygems'
require_gem 'activerecord'
require_gem 'actionpack'
require_gem 'actionmailer'
require_gem 'rails'

with these:


require 'rubygems'
require_gem 'activerecord', '<= 1.6.0'
require_gem 'actionpack', '<= 1.4.0'
require_gem 'actionmailer', '<= 0.6.1'
require_gem 'rails', '<= 0.9.5'

substituting the actual version numbers you found from gem list.

5 Comments

I’ve applied this fix (installed rails 0.9.5, uninstalled rails 0.10.0, modified ‘environment.rb’ to reference the installed versions of the components, but now see another type of routing error when I try to access http//tracks/login/signup

—————

ActionController::RoutingError in Login#signup

Showing /login/signup.rhtml where line #1 raised There are no routes defined!

(note: I had to re-format the tags so they’d show up here)

1: %= start_form_tag :action= “login” %

2:

3: div title=”Account login” id=”loginform” class=”form”

4:  h3 Please log in to use Tracks: /h3

—————

Are there further modifications necessary to make this work on apache? Thanks!

Michael: If you’re getting ‘no routes defined’ errors, that means that at least part of the application is being handled by Rails 0.10.0 level components. You need to make sure that all of the dependencies of Rails (ActiveRecord, ActionMailer, ActionPack etc. are at the previous levels (as I set out in my example).

Thank you for the speedy help. I finally figured it out…had to install the previous versions of activerecord, actionpack, and actionmailer…as well as rails.0.9.5. Now it works like a champ! Can’t wait to see this project evolve…it seems very useful!

I followed your instructions here to the letter and am still getting “Not Found” for /login/signup. I’ve uninstalled all but the versions of all the gems you have listed above to no avail. Being spewed to the console are errors including redcloth issues about already initialized constant VERSION and ActionController::SessionRestoreError: Session contained objects where the class definition wasn’t available. Remember to require classes for all objects kept in the session. The session has been deleted. ...

[”/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/cgi_process.rb:78:in `session’”, ”/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.4.0/lib/action_controller/base.rb:588:in `assign_shortcuts’”

...

rael: Hmm, I haven’t come across the SessionRestoreError before. I do know that there are intermittent problems with Redcloth (do you have v. 3.0.3?), but only when you run under the development environment. I think this is to do with the way that the dev environment loads dependencies while production requires them. So one thing you could try (if you aren’t already doing this) is to run under production:

ruby script/server—environment=production

Otherwise, all I can suggest is that you try restarting the server and trying again. Does anyone else have any ideas? I haven’t come across the error before and a Google didn’t unearth anything that looked helpful.

Could you let me know your platform and server?
-----

Name:

Email (not shown on page):

Location (optional):

URL:

Remember my personal information

Notify me of follow-up comments?

Please enter the word you see in the image below: