# Rails version coexistence

**URL:** <https://www.ruby-forum.com/t/rails-version-coexistence/111210>\
**Category:** Rails\
**Created:** [August 3, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/rails-version-coexistence/111210 "2007-08-03T20:51:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DuzenburyS\_Rich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/43a26b/32.png) [@DuzenburyS\_Rich](https://www.ruby-forum.com/u/DuzenburyS_Rich)\
**Post date:** [August 3, 2007, 8:51pm UTC](https://www.ruby-forum.com/t/rails-version-coexistence/111210/1 "2007-08-03T20:51:52Z")

</div>

Hi,

What is the correct way to get multiple rails installs to cooperate with  
each other?

I’ve got nine projects that I built on my (windows) workstation and  
deployed to a linux server. The linux server is running ruby 1.8.4 and  
rails 1.1.6. Another project came along and it was built on a different  
workstation, by a different developer, and I helped out after the fact.  
It’s on rails 1.2.3, which is frozen in the vendor subdirectory for that  
particular project.

In order to get things working on my local workstation, I had to update  
all of the gems, and I believe ruby. gem list on my local machine shows  
rails at 1.2.3 and 1.1.6. ruby -v shows 1.8.6.

However, since that update, I can’t start the local server on any of the  
older projects, which is hurting my ability to get anything done in  
those projects.

script/server on my workstation returns:  
ruby script/server  
./script/…/config/boot.rb:28:Warning: require\_gem is obsolete. Use gem  
instead.

The server starts, but will not process requests without throwing an  
“application error”

The development log shows the following:

$ tail -f development.log  
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:67:in  
`dispatch ' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick. rb:59 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`gem\_original\_re  
quire’  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/de pendenci es.rb:147:in`require’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_re quire' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/de  
pendenci  
es.rb:147:in `require' script/server:3 wrong number of arguments (1 for 0) c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/ven dor/mysq l.rb:551:in`initialize’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/ven  
dor/mysq  
l.rb:551:in `new' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/ven dor/mysq l.rb:551:in`scramble41’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/ven  
dor/mysq  
l.rb:141:in `real_connect' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/con nection_ adapters/mysql_adapter.rb:330:in`connect’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/con  
nection\_  
adapters/mysql\_adapter.rb:87:in `initialize' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/con nection_ adapters/mysql_adapter.rb:36:in`new’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/con  
nection\_  
adapters/mysql\_adapter.rb:36:in `mysql_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/con nection_ adapters/abstract/connection_specification.rb:251:in`send’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/con  
nection\_  
adapters/abstract/connection\_specification.rb:251:in  
`connection_without_query_c ache=' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/que ry_cache .rb:54:in`connection=’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/con  
nection\_  
adapters/abstract/connection\_specification.rb:220:in  
`retrieve_connection' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/con nection_ adapters/abstract/connection_specification.rb:78:in`connection’  
c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active\_record/bas  
e.rb:696  
:in `columns' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas e.rb:704 :in`columns\_hash’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/s  
ession/a  
ctive\_record\_store.rb:103:in `setup_sessid_compatibility!' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/s ession/a ctive_record_store.rb:77:in`find\_by\_session\_id’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/s  
ession/a  
ctive\_record\_store.rb:281:in `initialize' c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/active_record/bas e.rb:794 :in`silence’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/s  
ession/a  
ctive\_record\_store.rb:281:in `initialize' c:/ruby/lib/ruby/1.8/cgi/session.rb:273:in`new’  
c:/ruby/lib/ruby/1.8/cgi/session.rb:273:in `initialize' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/c gi_proce ss.rb:112:in`new’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/c  
gi\_proce  
ss.rb:112:in `session' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/c gi_proce ss.rb:142:in`stale\_session\_check!’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/c  
gi\_proce  
ss.rb:108:in `session' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/b ase.rb:9 18:in`assign\_shortcuts\_without\_flash’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/f  
lash.rb:  
141:in `assign_shortcuts' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/b ase.rb:4 02:in`process\_without\_filters’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action\_controller/f  
ilters.r  
b:377:in `process_without_session_management_support' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.5/lib/action_controller/s ession_m anagement.rb:117:in`process’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/dispatcher.rb:38:in  
`dispatch' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick_server.rb:115:in`handle\_  
dispatch’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:81:in  
`service’

c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:65:in`run’  
c:/ruby/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in`start’  
c:/ruby/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' c:/ruby/lib/ruby/1.8/webrick/server.rb:95:in`start’  
c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in `each' c:/ruby/lib/ruby/1.8/webrick/server.rb:92:in`start’  
c:/ruby/lib/ruby/1.8/webrick/server.rb:23:in `start' c:/ruby/lib/ruby/1.8/webrick/server.rb:82:in`start’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/webrick\_server.rb:67:in  
`dispatch ' c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/servers/webrick. rb:59 c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`gem\_original\_re  
quire’  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`require' c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/de pendenci es.rb:147:in`require’  
c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.6/lib/commands/server.rb:30  
c:/ruby/lib/ruby/site\_ruby/1.8/rubygems/custom\_require.rb:27:in  
`gem_original_re quire' c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in`require’  
c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/de  
pendenci  
es.rb:147:in `require’  
script/server:3

So, for the short term, how can I get get webrick to run both the old  
projects and new projects, on my local workstation, as needed, keeping  
in mind that the production server runs ruby 1.8.4 and rails 1.1.6?  
Second, is there a ‘correct’ way to upgrade a rails app from an older  
release? For example, I see that the boot.rb files from the older and  
newer projects have some differences.

Thank you.

Regards,

Rich

---

<div class="post-metadata">

**Author:** ![DuzenburyS\_Rich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/43a26b/32.png) [@DuzenburyS\_Rich](https://www.ruby-forum.com/u/DuzenburyS_Rich)\
**Post date:** [August 4, 2007, 3:47am UTC](https://www.ruby-forum.com/t/rails-version-coexistence/111210/2 "2007-08-04T03:47:35Z")

</div>

On Aug 3, 2007, at 13:51 , Duzenbury, Rich wrote:

> What is the correct way to get multiple rails installs to cooperate  
> with  
> each other?

AIUI, using vendor/rails is the standard way.

> particular project.  
> I’d consider going ahead and freezing Rails in each app, just to keep  
> things stable for each.

> However, since that update, I can’t start the local server on any  
> of the  
> older projects, which is hurting my ability to get anything done in  
> those projects.

I can imagine! Are the production installations working okay? If so,  
you can check which versions of Ruby and gems are used, and use them  
to reconfigure the development machines.

> script/server on my workstation returns:  
> ruby script/server  
> ./script/…/config/boot.rb:28:Warning: require\_gem is obsolete.  
> Use gem  
> instead.

As it says, this is just an warning, so I don’t think you need to  
worry about this, at least for now. (Though you should consider  
upgrading your Rails in these so this warning goes away.)

> dor/mysq  
> active\_record/con  
> c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/  
> active\_record/con  
> nection\_

It looks like you might be having problems connecting to your  
database server. Can you connect to your database outside of Rails  
using the configuration in database.yml? If not, I think that’s your  
error.

> So, for the short term, how can I get get webrick to run both the old  
> projects and new projects, on my local workstation, as needed, keeping  
> in mind that the production server runs ruby 1.8.4 and rails 1.1.6?  
> Second, is there a ‘correct’ way to upgrade a rails app from an older  
> release? For example, I see that the boot.rb files from the older and  
> newer projects have some differences.

I don’t know if there are any specific issues with using Ruby 1.8.4  
with Rails 1.1.6. The current recommendations are 1.8.5 for Rails 1.2.

Good luck!

Michael G.  
grzm seespotcode net

---

<div class="post-metadata">

**Author:** ![DuzenburyS\_Rich](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/43a26b/32.png) [@DuzenburyS\_Rich](https://www.ruby-forum.com/u/DuzenburyS_Rich)\
**Post date:** [August 17, 2007, 12:02am UTC](https://www.ruby-forum.com/t/rails-version-coexistence/111210/3 "2007-08-17T00:02:25Z")

</div>

> On Aug 3, 2007, at 13:51 , Duzenbury, Rich wrote:
> 
> > different workstation, by a different developer, and I helped out  
> > anything done  
> > instead.  
> > c:/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.4/lib/  
> > l.rb:141:in `real\_connect’  
> > nection\_  
> > database server. Can you connect to your database outside of  
> > release? For example, I see that the boot.rb files from  
> > grzm seespotcode net

Hi,

Thanks for the info, it is helpful. In answer to your questions, all  
the sites work fine on the production server, which is rails 1.1.6, and  
ruby 1.8.4. I had to upgrade my workstation, which is now rails 1.2.3  
and ruby 1.8.6. It’s my workstation that can’t seem to play in both the  
old and new rails sites. The old sites throw an error in the mysql  
module.

After digging around in the mysql.rb of active record, I discovered  
there is a co-existence problem between rails 1.1.6 and ruby 1.8.6.  
Specifically, the Digest::SHA1 interface was changed. Not sure why.

Here is my hack:

def scramble41(password, message)  
return 0x00.chr if password.nil? or password.empty?  
buf = [0x14]

```
# Work with older or newer ruby
if RUBY_VERSION.gsub(/\./, '').to_i < 186
  s1 = Digest::SHA1.new(password).digest
  s2 = Digest::SHA1.new(s1).digest
  x = Digest::SHA1.new(message + s2).digest
else
  s1 = Digest::SHA1.digest(password)
  s2 = Digest::SHA1.digest(s1)
  x = Digest::SHA1.digest(message + s2)
end

(0..s1.length - 1).each {|i| buf.push(s1[i] ^ x[i])}
buf.pack("C*")

```

end

At least I can work with both the old and new projects on my workstation  
now.

Thank you.

Regards,  
Rich
