# ' X is not missing constant Y ' , problem after rails update

**URL:** <https://www.ruby-forum.com/t/x-is-not-missing-constant-y-problem-after-rails-update/92366>\
**Category:** Rails\
**Created:** [April 18, 2007, 6:34pm UTC](https://www.ruby-forum.com/t/x-is-not-missing-constant-y-problem-after-rails-update/92366 "2007-04-18T18:34:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![friofool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@friofool](https://www.ruby-forum.com/u/friofool)\
**Post date:** [April 18, 2007, 6:34pm UTC](https://www.ruby-forum.com/t/x-is-not-missing-constant-y-problem-after-rails-update/92366/1 "2007-04-18T18:34:05Z")

</div>

Hello,

I’m just updating my rails version to 1.2.3  
I get the ’ X is not missing constant Y’ message for all request in my  
existing applications.

Exemple :

app/controller/login/login.rb

use a model in :

app/models/login/connect.rb

This exemple give the error :

" Login is not missing constant Connect! "

What’s wrong im my configuration ?

---

<div class="post-metadata">

**Author:** ![friofool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@friofool](https://www.ruby-forum.com/u/friofool)\
**Post date:** [April 18, 2007, 6:42pm UTC](https://www.ruby-forum.com/t/x-is-not-missing-constant-y-problem-after-rails-update/92366/2 "2007-04-18T18:42:36Z")

</div>

On 4/18/07, Frioffol F. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> use a model in :
> 
> app/models/login/connect.rb
> 
> This exemple give the error :
> 
> " Login is not missing constant Connect! "
> 
> What’s wrong im my configuration ?

app/models/login/connect.rb

^^^^ whats wrong with your model? why have to stuck them inside login  
folder? If you must do something like that, then make sure, you  
inherit stuff properly.

I have seen this stuff before, when i i tried to do something like  
this, in one of my plugins.

class ActiveRecord::Schema

# some migration foobar

end

Rewriting above code like this:

module ActiveRecord  
class Schema  
# some migration foobar  
end  
end

fixed the error. 🙂

–  
gnufied

---

<div class="post-metadata">

**Author:** ![friofool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@friofool](https://www.ruby-forum.com/u/friofool)\
**Post date:** [April 18, 2007, 7:06pm UTC](https://www.ruby-forum.com/t/x-is-not-missing-constant-y-problem-after-rails-update/92366/3 "2007-04-18T19:06:39Z")

</div>

i put this file in model/login/connect.rb to have a clean structure.

my connect.rb is :

class Login::Connect \< ActiveRecord::Base

end

and my login.rb is :

class Login::LoginController \< ApplicationController

end

Maybe there is a best method to do that, but before i update my rails  
version, the application works fine.

i don’t know what to do…

---

<div class="post-metadata">

**Author:** ![friofool](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/6de8d8/32.png) [@friofool](https://www.ruby-forum.com/u/friofool)\
**Post date:** [June 5, 2009, 11:28pm UTC](https://www.ruby-forum.com/t/x-is-not-missing-constant-y-problem-after-rails-update/92366/4 "2009-06-05T23:28:40Z")

</div>

Hemant K. wrote:

> I have seen this stuff before, when i i tried to do something like  
> this, in one of my plugins.
> 
> class ActiveRecord::Schema
> 
> # some migration foobar
> 
> end
> 
> Rewriting above code like this:
> 
> module ActiveRecord  
> class Schema  
> # some migration foobar  
> end  
> end
> 
> fixed the error. 🙂

In Rails 2.x, this approach only takes us halfway to the solution. See  
this bug report[1] for the rest of the solution, which involves  
monkeypatching the load\_missing\_constant() method.

[1]  
[https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2283-unnecessary-exception-raised-in-asdependenciesload\_missing\_constant](https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2283-unnecessary-exception-raised-in-asdependenciesload_missing_constant)
