# Superclass mismatch with Rails 3

**URL:** <https://www.ruby-forum.com/t/superclass-mismatch-with-rails-3/186176>\
**Category:** Rails\
**Created:** [April 1, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/superclass-mismatch-with-rails-3/186176 "2010-04-01T17:17:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![philostler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dbc845/32.png) [@philostler](https://www.ruby-forum.com/u/philostler)\
**Post date:** [April 1, 2010, 5:17pm UTC](https://www.ruby-forum.com/t/superclass-mismatch-with-rails-3/186176/1 "2010-04-01T17:17:02Z")

</div>

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 O.\Desktop\Project\Rails\>ruby script\rails server

C:/Users/Phil O./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`’

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

---

<div class="post-metadata">

**Author:** ![philostler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dbc845/32.png) [@philostler](https://www.ruby-forum.com/u/philostler)\
**Post date:** [April 1, 2010, 8:16pm UTC](https://www.ruby-forum.com/t/superclass-mismatch-with-rails-3/186176/2 "2010-04-01T20:16:47Z")

</div>

“Phil O.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote in  
message news:removed\_email\_address@domain.invalid…

> 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.

---

<div class="post-metadata">

**Author:** ![philostler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dbc845/32.png) [@philostler](https://www.ruby-forum.com/u/philostler)\
**Post date:** [April 2, 2010, 2:02pm UTC](https://www.ruby-forum.com/t/superclass-mismatch-with-rails-3/186176/3 "2010-04-02T14:02:11Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![philostler](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/dbc845/32.png) [@philostler](https://www.ruby-forum.com/u/philostler)\
**Post date:** [April 2, 2010, 3:26pm UTC](https://www.ruby-forum.com/t/superclass-mismatch-with-rails-3/186176/4 "2010-04-02T15:26:14Z")

</div>

On Fri, Apr 2, 2010 at 8:02 AM, Phil O. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Now running Ruby 1.9.1-p378-rc2 with Rails 3.0.0.beta2!  
> 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.  
> –  
> Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Github: [rubyredrick (Rick DeNatale) · GitHub](http://github.com/rubyredrick)  
Twitter: @RickDeNatale  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)
