# Strangest restful\_authentication 'unidentified method' error

**URL:** <https://www.ruby-forum.com/t/strangest-restful-authentication-unidentified-method-error/112223>\
**Category:** Rails\
**Created:** [August 16, 2007, 4:21pm UTC](https://www.ruby-forum.com/t/strangest-restful-authentication-unidentified-method-error/112223 "2007-08-16T16:21:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![builderchad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9e8a1a/32.png) [@builderchad](https://www.ruby-forum.com/u/builderchad)\
**Post date:** [August 16, 2007, 4:21pm UTC](https://www.ruby-forum.com/t/strangest-restful-authentication-unidentified-method-error/112223/1 "2007-08-16T16:21:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![builderchad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9e8a1a/32.png) [@builderchad](https://www.ruby-forum.com/u/builderchad)\
**Post date:** [August 16, 2007, 5:15pm UTC](https://www.ruby-forum.com/t/strangest-restful-authentication-unidentified-method-error/112223/2 "2007-08-16T17:15:25Z")

</div>

On 16 Aug 2007, at 16:21, Chad T. wrote:

> 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

---

<div class="post-metadata">

**Author:** ![builderchad](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9e8a1a/32.png) [@builderchad](https://www.ruby-forum.com/u/builderchad)\
**Post date:** [August 17, 2007, 4:10am UTC](https://www.ruby-forum.com/t/strangest-restful-authentication-unidentified-method-error/112223/3 "2007-08-17T04:10:06Z")

</div>

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 🙂
