Chad Thatcher
2007-Aug-16 14:21 UTC
Strangest restful_authentication ''unidentified method'' error
Hi. My head is about to explode on this one. I am using restful_authentication and added a method to lib/authentication_system.rb like so: module AuthenticatedSystem protected def logged_in? current_user != :false end def role_at_least(role) return true end ... end The method "logged_in?" that came with the plugin is always found and works. But when I call role_at_least() it always returns: undefined method `role_at_least'' for #<#<Class:0x38909f4>:0x38909cc> I have pulled all my hair out and tried just about everything. Restarted the webrick, tried mongrel, restarted my machine even... If I remove the logged_in? definition I get the expected "undefined method `logged_in?'' " message. I then put it back and it works perfectly, but role_at_least has never been visible. I even tried removing the parameter to see if it would make any difference but I similarily get: undefined local variable or method `role_at_least'' for #<#<Class:0x39efc28>:0x39efc00> I would really appreciate any help or tips on how I can further debug this. Thanks, Chad. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt
2007-Aug-16 15:14 UTC
Re: Strangest restful_authentication ''unidentified method'' error
On 16 Aug 2007, at 16:21, Chad Thatcher wrote:> The method "logged_in?" that came with the plugin is always found and > works. But when I call role_at_least() it always returns: > > undefined method `role_at_least'' for #<#<Class:0x38909f4>:0x38909cc> > > > I have pulled all my hair out and tried just about everything. > Restarted the webrick, tried mongrel, restarted my machine even... > > If I remove the logged_in? definition I get the expected "undefined > method `logged_in?'' " message. I then put it back and it works > perfectly, but role_at_least has never been visible. I even tried > removing the parameter to see if it would make any difference but I > similarily get: > > undefined local variable or method `role_at_least'' for > #<#<Class:0x39efc28>:0x39efc00> > > I would really appreciate any help or tips on how I can further debug > this.Look a bit further in the code: def self.included(base) base.send :helper_method, :current_user, :logged_in? end You''ll need to add your role_at_least method to this list. This includes the methods as ActionView helper methods. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chad Thatcher
2007-Aug-17 02:10 UTC
Re: Strangest restful_authentication ''unidentified method'' e
Thanks Peter, that solved my problem. I feel like a bit of an idiot because I did grep the source tree for logged_in? to see where else it may be being declared or otherwise used but I completely missed it in "included". Going to go brush up on modules in Ruby now :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---