Uninitialized constant User::Authentication

Hi there,

I just ran the generator for Restful Authentication, and when I visit
localhost:3000/users/new, I get the error: uninitialized constant
User::Authentication

The error comes from these lines in my user.rb model:

class User < ActiveRecord::Base
include Authentication
include Authentication::ByPassword
include Authentication::ByCookieToken

Did I miss something in the installation process? This is my first time
using a generator, so I’m probably just doing something dumb :confused:

I still haven’t figured this out yet. Am I missing a file somewhere?

I am getting the same error but only on my production server. Locally
I am fine.

Is there some gem I may be missing that this requires? I am receiving
the error on line 4 of the User model

include Authentication

http://rails_security.lighthouseapp.com/projects/15332/tickets/2-not-a-valid-constant-name-errors#ticket-2-1

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

Hopefully the maintainers will consider renaming this plugin.

yaphi wrote:

Is there some gem I may be missing that this requires? I am receiving
the error on line 4 of the User model

include Authentication

I have already done this on my local machine. I am talking
specifically getting this error on my production server. Locally
everything works dandy! Same rails versions and everything.

On Aug 13, 2:12 am, Nitish B. [email protected]

Also, it only happens when I hit /signup not /login on my production
machine

I had this problem and after much work discovered that the session on
my browser was confusing the server somehow. My deleting the cookie I
was able to access all the pages correctly without errors.

Boys,
Almost all the time this problem arises because , scope of the
Authentication module falls under different context , Its always
better to use fully qualified module names,

class User < ActiveRecord::Base
include ::Authentication
include ::Authentication::ByPassword
include ::Authentication::ByCookieToken
include ::Authorization::AasmRoles

This has to work all the time…

-Abhishek ( parolkar (Abhishek Parolkar) · GitHub )

PS: I faced it while trying Typus,

Typus::Authentication::ByPassword
NameError: uninitialized constant Typus::Authentication::ByPassword

I had the same problem, but restarting script/server fixed it.

Ozgun Koyun wrote:

It didn’t work for me.

I had to comment out “config.active_record.observers = :user_observer”.
It may not be the perfect solution, but it saved the day. However, I
don’t know what tomorrow brings :slight_smile:

On the other hand, you should also check if
“vendor/plugins/restful_authentication” is checked into your repository
:), and it is deployed to the server successfully.

abhishek.parolkar wrote:

Boys,
Almost all the time this problem arises because , scope of the
Authentication module falls under different context , Its always
better to use fully qualified module names,

class User < ActiveRecord::Base
include ::Authentication
include ::Authentication::ByPassword
include ::Authentication::ByCookieToken
include ::Authorization::AasmRoles

This has to work all the time…

-Abhishek ( parolkar (Abhishek Parolkar) · GitHub )

PS: I faced it while trying Typus,

Typus::Authentication::ByPassword
NameError: uninitialized constant Typus::Authentication::ByPassword

It didn’t work for me.

I had to comment out “config.active_record.observers = :user_observer”.
It may not be the perfect solution, but it saved the day. However, I
don’t know what tomorrow brings :slight_smile:

Dave A. wrote:

Hi there,

I just ran the generator for Restful Authentication, and when I visit
localhost:3000/users/new, I get the error: uninitialized constant
User::Authentication

The error comes from these lines in my user.rb model:

class User < ActiveRecord::Base
include Authentication
include Authentication::ByPassword
include Authentication::ByCookieToken

Did I miss something in the installation process? This is my first time
using a generator, so I’m probably just doing something dumb :confused:

I just had the same problem today, after I cloned a skeleton app i was
working on so that I could expand it as a different app, git clone
failed to copy anything form restful_authentication folder! weird!

Dave A. wrote:

I still haven’t figured this out yet. Am I missing a file somewhere?

I had to move my restful_authenication to the vendor/plugins and that
fixed the error message and now everything works.

Reth11

Dave A. wrote:

Hi there,

I just ran the generator for Restful Authentication, and when I visit
localhost:3000/users/new, I get the error: uninitialized constant
User::Authentication

Since you just put restful_auth into your project, do yourself a favor
and take it right back out again. It’s garbage. It relies on
unmaintainable generated code. It’s easy to set up, but a nightmare to
do anything with. I speak from experience.

Use something reasonable like Authlogic instead.

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

Daniel X Moore wrote:

I had the same problem, but restarting script/server fixed it.

This help!

Daniel X Moore wrote:

I had the same problem, but restarting script/server fixed it.

same to me