I''m setting up authentication with Authlogic and I get this error.
I''ve done some searching but with no success. I tried setting the
current_user method in Application_controller to protected and not
private, on the recommendation in Stack Overflow.
Error in browser-----------------
NoMethodError in User sessionsController#new
undefined method `require_no_user'' for #<UserSessionsController:
0x24fc700>
Error in terminal------------------
Processing UserSessionsController#new (for 127.0.0.1 at 2009-10-17
23:26:38) [GET]
Parameters: {"action"=>"new",
"controller"=>"user_sessions"}
NoMethodError (undefined method `require_no_user'' for
#<UserSessionsController:0x24fc700>):
Rendered rescues/_trace (29.9ms)
Rendered rescues/_request_and_response (1.3ms)
Rendering rescues/layout (internal_server_error)
------------------------------------------
FYI------------------------------------
Rails version: 2.3.4
Ruby version: 1.8.6
Hi Kevin If I am getting it right then either you haven''t declared require_no_user in your application controller. or haven''t set up it before_filter in application controller. Please paste your code so that I can solve your problem precisely. http://blog.railsjaipur.in/ On Oct 18, 8:37 am, Kevin M <meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m setting up authentication with Authlogic and I get this error. > I''ve done some searching but with no success. I tried setting the > current_user method in Application_controller to protected and not > private, on the recommendation in Stack Overflow. > > Error in browser----------------- > NoMethodError in User sessionsController#new > > undefined method `require_no_user'' for #<UserSessionsController: > 0x24fc700> > > Error in terminal------------------ > Processing UserSessionsController#new (for 127.0.0.1 at 2009-10-17 > 23:26:38) [GET] > Parameters: {"action"=>"new", "controller"=>"user_sessions"} > > NoMethodError (undefined method `require_no_user'' for > #<UserSessionsController:0x24fc700>): > > Rendered rescues/_trace (29.9ms) > Rendered rescues/_request_and_response (1.3ms) > Rendering rescues/layout (internal_server_error) > > ------------------------------------------ > > FYI------------------------------------ > Rails version: 2.3.4 > Ruby version: 1.8.6
Here''s the code.
Application_controller.rb---------------------------------
class ApplicationController < ActionController::Base
filter_parameter_logging :password, :password_confirmation
helper_method :current_user_session, :current_user
private
def current_user_session
return @current_user_session if defined?
(@current_user_session)
@current_user_session = UserSession.find
end
protected
def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session &&
current_user_session.user
end
end
----------------------------------------
Thanks for your help.
Kevin
On Oct 17, 11:56 pm, "bagwan.pankaj"
<bagwanpan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> HiKevin
>
> If I am getting it right then
> either
> you haven''t declared require_no_user in your application
controller.
> or
> haven''t set up it before_filter in application controller.
>
> Please paste your code so that I can solve your problem precisely.
>
> http://blog.railsjaipur.in/
>
> On Oct 18, 8:37 am,KevinM
<meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > I''m setting up authentication with Authlogic and I get this
error.
> > I''ve done some searching but with no success. I tried setting
the
> > current_user method in Application_controller to protected and not
> > private, on the recommendation in Stack Overflow.
>
> > Error in browser-----------------
> > NoMethodError in User sessionsController#new
>
> > undefined method `require_no_user'' for
#<UserSessionsController:
> > 0x24fc700>
>
> > Error in terminal------------------
> > Processing UserSessionsController#new (for 127.0.0.1 at 2009-10-17
> > 23:26:38) [GET]
> > Parameters: {"action"=>"new",
"controller"=>"user_sessions"}
>
> > NoMethodError (undefined method `require_no_user'' for
> > #<UserSessionsController:0x24fc700>):
>
> > Rendered rescues/_trace (29.9ms)
> > Rendered rescues/_request_and_response (1.3ms)
> > Rendering rescues/layout (internal_server_error)
>
> > ------------------------------------------
>
> > FYI------------------------------------
> > Rails version: 2.3.4
> > Ruby version: 1.8.6
Hi Kevin, You have''t defined require_user and require_no_user in your application controller. Please define them first. Go through the authlogic''s tutorial. Everything is defined there if you don''t find it there then I''ll get out of this error. Hope you are enjoying RoR. Bagwan Pankaj On Oct 18, 5:50 pm, Kevin M <meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Here''s the code. > > Application_controller.rb--------------------------------- > class ApplicationController < ActionController::Base > filter_parameter_logging :password, :password_confirmation > helper_method :current_user_session, :current_user > > private > def current_user_session > return @current_user_session if defined? > (@current_user_session) > @current_user_session = UserSession.find > end > > protected > def current_user > return @current_user if defined?(@current_user) > @current_user = current_user_session && > current_user_session.user > end > > end > ---------------------------------------- > > Thanks for your help. > > Kevin > > On Oct 17, 11:56 pm, "bagwan.pankaj" <bagwanpan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > HiKevin > > > If I am getting it right then > > either > > you haven''t declared require_no_user in your application controller. > > or > > haven''t set up it before_filter in application controller. > > > Please paste your code so that I can solve your problem precisely. > > >http://blog.railsjaipur.in/ > > > On Oct 18, 8:37 am,KevinM <meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I''m setting up authentication with Authlogic and I get this error. > > > I''ve done some searching but with no success. I tried setting the > > > current_user method in Application_controller to protected and not > > > private, on the recommendation in Stack Overflow. > > > > Error in browser----------------- > > > NoMethodError in User sessionsController#new > > > > undefined method `require_no_user'' for #<UserSessionsController: > > > 0x24fc700> > > > > Error in terminal------------------ > > > Processing UserSessionsController#new (for 127.0.0.1 at 2009-10-17 > > > 23:26:38) [GET] > > > Parameters: {"action"=>"new", "controller"=>"user_sessions"} > > > > NoMethodError (undefined method `require_no_user'' for > > > #<UserSessionsController:0x24fc700>): > > > > Rendered rescues/_trace (29.9ms) > > > Rendered rescues/_request_and_response (1.3ms) > > > Rendering rescues/layout (internal_server_error) > > > > ------------------------------------------ > > > > FYI------------------------------------ > > > Rails version: 2.3.4 > > > Ruby version: 1.8.6
Thanks for your help. I fixed that and figured out another one myself. I hope to enjoy it more, but it looks promising. Kevin On Oct 18, 12:45 pm, "bagwan.pankaj" <bagwanpan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> HiKevin, > > You have''t defined require_user and require_no_user in your > application controller. > Please define them first. > Go through the authlogic''s tutorial. Everything is defined there > if you don''t find it there then I''ll get out of this error. > > Hope you are enjoying RoR. > > Bagwan Pankaj > > On Oct 18, 5:50 pm,KevinM <meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Here''s the code. > > > Application_controller.rb--------------------------------- > > class ApplicationController < ActionController::Base > > filter_parameter_logging :password, :password_confirmation > > helper_method :current_user_session, :current_user > > > private > > def current_user_session > > return @current_user_session if defined? > > (@current_user_session) > > @current_user_session = UserSession.find > > end > > > protected > > def current_user > > return @current_user if defined?(@current_user) > > @current_user = current_user_session && > > current_user_session.user > > end > > > end > > ---------------------------------------- > > > Thanks for your help. > > >Kevin > > > On Oct 17, 11:56 pm, "bagwan.pankaj" <bagwanpan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > HiKevin > > > > If I am getting it right then > > > either > > > you haven''t declared require_no_user in your application controller. > > > or > > > haven''t set up it before_filter in application controller. > > > > Please paste your code so that I can solve your problem precisely. > > > >http://blog.railsjaipur.in/ > > > > On Oct 18, 8:37 am,KevinM <meyer.kevi...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I''m setting up authentication with Authlogic and I get this error. > > > > I''ve done some searching but with no success. I tried setting the > > > > current_user method in Application_controller to protected and not > > > > private, on the recommendation in Stack Overflow. > > > > > Error in browser----------------- > > > > NoMethodError in User sessionsController#new > > > > > undefined method `require_no_user'' for #<UserSessionsController: > > > > 0x24fc700> > > > > > Error in terminal------------------ > > > > Processing UserSessionsController#new (for 127.0.0.1 at 2009-10-17 > > > > 23:26:38) [GET] > > > > Parameters: {"action"=>"new", "controller"=>"user_sessions"} > > > > > NoMethodError (undefined method `require_no_user'' for > > > > #<UserSessionsController:0x24fc700>): > > > > > Rendered rescues/_trace (29.9ms) > > > > Rendered rescues/_request_and_response (1.3ms) > > > > Rendering rescues/layout (internal_server_error) > > > > > ------------------------------------------ > > > > > FYI------------------------------------ > > > > Rails version: 2.3.4 > > > > Ruby version: 1.8.6
Seemingly Similar Threads
- desperate, errors with file upload
- RSpec with Rails 3.1rc4: spec test won't recognize <%= %> (should be simple)
- step definitons to check login
- NoMethodError in User sessionsController#create - Authlogic
- Authlogic and rails 3 : NameError in User sessionsController#new