undefined method `authenticate_user!' for #<HomeController:0xa156ad0>

2,659 views
Skip to first unread message

webo

unread,
Feb 10, 2011, 9:43:10 PM2/10/11
to plataforma...@googlegroups.com
I have a new Rails 3.0.4 installation and the latest devise (1.1.5)  I've followed the getting started on the devise github page to the letter (called my user model "User" etc.)

When I add the "before_filter :authenticate_user!" to my controller, I've posted my home controller below:

class HomeController < ApplicationController
before_filter :authenticate_user!

def index

end

end

When I go to see the page, it gives me the "undefined" error.  Any ideas?

Jim Ruther Nill

unread,
Feb 10, 2011, 10:01:34 PM2/10/11
to plataforma...@googlegroups.com
could you paste a stack trace.
--
-------------------------------------------------------------
visit my blog at http://jimlabs.heroku.com

webo

unread,
Feb 10, 2011, 10:03:31 PM2/10/11
to plataforma...@googlegroups.com
Here's a link to a full trace from the error page: http://pastie.org/1551302

Jim Ruther Nill

unread,
Feb 10, 2011, 10:08:59 PM2/10/11
to plataforma...@googlegroups.com
thanks but could you include the exact error?


On Fri, Feb 11, 2011 at 11:03 AM, webo <ftse...@gmail.com> wrote:
Here's a link to a full trace from the error page: http://pastie.org/1551302



webo

unread,
Feb 10, 2011, 10:13:00 PM2/10/11
to plataforma...@googlegroups.com
The exact error is in the title also but this is the line from the development log

NoMethodError (undefined method `authenticate_user!' for #<HomeController:0xabe06a4>):

Jim Ruther Nill

unread,
Feb 10, 2011, 10:21:49 PM2/10/11
to plataforma...@googlegroups.com
I can't replicate your problem using rails 3.0.4 and devise 1.1.5 (I created an empty project if you want).  Just double checking, but did you restart your server after running bundle install?


On Fri, Feb 11, 2011 at 11:13 AM, webo <ftse...@gmail.com> wrote:
The exact error is in the title also but this is the line from the development log

NoMethodError (undefined method `authenticate_user!' for #<HomeController:0xabe06a4>):



webo

unread,
Feb 10, 2011, 10:26:33 PM2/10/11
to plataforma...@googlegroups.com
You have to be kidding me.  A restart fixed it.

Is there a reason for that?  I thought development mode reloaded the rails environment every time you access it.

Jim Ruther Nill

unread,
Feb 10, 2011, 10:32:22 PM2/10/11
to plataforma...@googlegroups.com
Development mode reloads the classes in your app not the gems. So everytime you install a new gem which you're going to use, you need to restart your app. :) I'm glad it's a simple fix.


On Fri, Feb 11, 2011 at 11:26 AM, webo <ftse...@gmail.com> wrote:
You have to be kidding me.  A restart fixed it.

Is there a reason for that?  I thought development mode reloaded the rails environment every time you access it.



Darren

unread,
Mar 28, 2011, 1:25:52 AM3/28/11
to Devise
I'm getting the same error... A restart doesn't seem to help..

Here's the full trace with file excerpts: http://pastie.org/1725099

It's strange, I've used Devise plenty of times but I'm left scratching
my head here...

Darren Jeacocke

unread,
Mar 28, 2011, 3:02:43 AM3/28/11
to plataforma...@googlegroups.com
Found it. I forgot to add this:

## routes.rb
devise_for :users

Reply all
Reply to author
Forward
0 new messages