# Restful Authentication Uninitialized Constant in Production

**URL:** <https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477>\
**Category:** Rails\
**Created:** [January 12, 2009, 3:24am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477 "2009-01-12T03:24:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [January 12, 2009, 3:24am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477/1 "2009-01-12T03:24:53Z")

</div>

rake db:migrate RAILS\_ENV=production  
rake aborted!  
uninitialized constant User::Authentication

The preceding I encounter when attempting to migrate to the production  
database. My google powers have escaped me. Everywhere says Restful  
Authentication is missing in the production server. However, to  
validate this, I attempted this on the same server as the development,  
which works.

So, what could cause the production environment to not see something  
that is there, when the development environment can?

Ahh. While writing this, I decided to change:

RAILS\_GEM\_VERSION = ‘2.2.2’ unless defined? RAILS\_GEM\_VERSION

to this

RAILS\_GEM\_VERSION = ‘2.1.0’ unless defined? RAILS\_GEM\_VERSION

And, things work fine. Now to find out why. I don’t like having to  
step downward…

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [January 12, 2009, 3:35am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477/2 "2009-01-12T03:35:25Z")

</div>

On Jan 11, 9:24 pm, Ben W. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> So, what could cause the production environment to not see something  
> And, things work fine. Now to find out why. I don’t like having to  
> step downward…

Nope, that just gets me to…

ActionView::TemplateError (uninitialized constant  
User::Authentication)

So, WTF?

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [January 12, 2009, 4:03am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477/3 "2009-01-12T04:03:00Z")

</div>

[http://www.mail-archive.com/removed\_email\_address@domain.invalid/msg00009.html](http://www.mail-archive.com/removed_email_address@domain.invalid/msg00009.html)

says  
…rename vendor/plugins/authentication-plugin to something without a  
hyphen character (like ‘authentication’ or ‘restful\_authentication’).

Hope this helps

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [January 13, 2009, 1:54am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477/4 "2009-01-13T01:54:49Z")

</div>

Further information on my inability to get Restful Authentication to  
work:

/home/…/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active\_support/  
dependencies.rb:102:in `const_missing' app/models/user.rb:24 lib/authenticated_system.rb:125:in`login\_from\_cookie’  
lib/authenticated\_system.rb:12:in `current_user' lib/authenticated_system.rb:6:in`logged\_in?’  
(eval):2:in `send' (eval):2:in`logged\_in?’  
app/views/shared/\_entryway.html.haml:3  
app/views/layouts/standard.html.haml:15

This is from running “script/server RAILS\_ENV=production” when I just  
run script/server, things work fine on the prod server. Both  
environments work fine on the dev server…

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [January 12, 2009, 4:52am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477/5 "2009-01-12T04:52:06Z")

</div>

Thanks for the quick reply. The following are the names of the plugins  
I presently have installed. None have hyphens.

drwx------ 3 … … 4096 2009-01-11 15:38 haml/  
drwx------ 5 … … 4096 2009-01-11 21:25 restful\_authentication/  
drwx------ 5 … … 4096 2009-01-11 15:38 role\_requirement/

---

<div class="post-metadata">

**Author:** ![blacknight](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/c68b51/32.png) [@blacknight](https://www.ruby-forum.com/u/blacknight)\
**Post date:** [January 14, 2009, 2:56am UTC](https://www.ruby-forum.com/t/restful-authentication-uninitialized-constant-in-production/157477/6 "2009-01-14T02:56:41Z")

</div>

Ben W. wrote:

> Further information on my inability to get Restful Authentication to  
> work:
> 
> /home/…/.gem/ruby/1.8/gems/activesupport-2.2.2/lib/active\_support/  
> dependencies.rb:102:in `const_missing' app/models/user.rb:24 lib/authenticated_system.rb:125:in `login\_from\_cookie’  
> lib/authenticated\_system.rb:12:in `current_user' lib/authenticated_system.rb:6:in `logged\_in?’  
> (eval):2:in `send' (eval):2:in `logged\_in?’  
> app/views/shared/\_entryway.html.haml:3  
> app/views/layouts/standard.html.haml:15
> 
> This is from running “script/server RAILS\_ENV=production” when I just  
> run script/server, things work fine on the prod server. Both  
> environments work fine on the dev server…

Are you using AASM by any chance?

You might need to add “require ‘aasm’” in your application.rb.

Regards,

# rp8

> **[Competo Solutions, Inc.](https://competo.com/)**
>
> Sharing our experience in ever changing tech landscapes
