Superclass mismatch with Rails 3

I'm currently developing a Rails 2 project that I'd like to migrate
across to Rail 3. However I'm having real trouble in the first place
getting Rails 3 to work straight out of the box with a blank project.

Initially I tried getting this working a JRuby 1.5 snapshot & then 1.4.
I've now been trying the same with Ruby 1.9.1-p378-rc2 from
RubyInstaller with the same results.

The error:
Upon executing "ruby script\rails server" (rails server doesn't work in
Windows. Running Win7 btw) I always get the following error...

C:\Users\Phil Ostler\Desktop\Project\Rails>ruby script\rails server

C:/Users/Phil Ostler/Desktop/Project/Rails/config/application.rb:9:in
`<module:Rails>': superclass mismatch for class Application (TypeError)
        from C:/Users/Phil
Ostler/Desktop/Project/Rails/config/application.rb:8:in `<top
(required)>'
        from
C:/Ruby19/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/co
mmands.rb:36:in `require'
        from
C:/Ruby19/lib/ruby/gems/1.9.1/gems/railties-3.0.0.beta/lib/rails/co
mmands.rb:36:in `<top (required)>'
        from script/rails:10:in `require'
        from script/rails:10:in `<main>'

I've tried using the latest gems as well as following any guides I could
find and matching the gem versions they used but always get the same
result.

Current local gem list:
*** LOCAL GEMS ***
abstract (1.0.0)
actionmailer (3.0.0.beta)
actionpack (3.0.0.beta)
activemodel (3.0.0.beta)
activerecord (3.0.0.beta)
activeresource (3.0.0.beta)
activesupport (3.0.0.beta, 2.3.5)
arel (0.2.1)
builder (2.1.2)
bundler (0.9.10)
erubis (2.6.5)
i18n (0.3.5)
mail (2.1.3)
memcache-client (1.7.8)
mime-types (1.16)
polyglot (0.3.1)
rack (1.1.0)
rack-mount (0.6.0, 0.4.7)
rack-test (0.5.3)
rails (3.0.0.beta)
railties (3.0.0.beta)
rake (0.8.7)
rubygems-update (1.3.6)
text-format (1.0.0)
text-hyphen (1.0.0)
thor (0.13.4)
treetop (1.4.5)
tzinfo (0.3.16)

I've googled this and vaguely understand the error but don't know how to
go about fixing it. I get the feeling this might not be my setup and
more a gem that's breaking Rail 3 but that could be miles off the mark.

Any suggestions?

Cheers, Phil

"Phil Ostler" <lists@ruby-forum.com> wrote in message news:7e3f1c8e83517d604d3d7ab7545ffd43@ruby-forum.com...

I'm currently developing a Rails 2 project that I'd like to migrate
across to Rail 3. However I'm having real trouble in the first place
getting Rails 3 to work straight out of the box with a blank project.

First a hint. There is a gem named rails3b that somebody in the rails core team created to pull in the missing dependecies of the Rails gem when using the rails 3 beta.

Second, Your problem is naming the test application "Rails". That results in a module named "Rails" that contains your application, but the Rails module is part of Rails' own namespace.

Thus your config/application.rb is trying to create or re-open a Rails::Application class that is derived from Rails::Application. I'm not an expert in that corner of Ruby, but I'm not sure tryingg to have a class derive from itself could ever be expected to work. Further Rails::Application is already defined, and it has a different base class, so ruby has no idea what to do, so it spits out an error and stops.

Try creating a project with a unique name. You should probably find that works better.

Indeed you are right, changing the name of my application has fixed
this. Thank you!

Reason for me naming it Rails is because I have separate folders in my
project development for different elements (e.g. Rails, Database Schema,
Flex) and it always worked in Rails 2 fine for me this way.

I've used rails3b before but was mix and matching gem versions to try
and get around this problem.

Now running Ruby 1.9.1-p378-rc2 with Rails 3.0.0.beta2!

Next stop, JRuby 1.5.0 dev snapshot...

Cheers!

From what I've read 1.9.1 is NOT recommended for use with Rails3 beta
2, they want us to use the latest pre-release version of 1.9.2
instead.