<p>I don't understand why one method would work and the other would throw a NoMethodError if they come from the same lib file.</p>

<pre><code># app/views/bunnies/show.html.erb
&lt;% if logged_in? %&gt;
  &lt;%= current_user.login %&gt; |
  &lt;%= link_to 'Logout', logout_path %&gt; |
  &lt;% if authorized? %&gt;
    &lt;%= link_to 'Edit Details', edit_bunny_path(@broker) %&gt; |
  &lt;% end %&gt;
  &lt;%= link_to 'Back', bunnies_path %&gt;
&lt;% end %&gt;
</code></pre>

<p>... throws a NoMethodError for <code>authorized?</code>.  If I comment that if block out, the page works fine (with <code>logged<code>_</code>in?</code>).</p>

<pre><code># lib/authenticated_system.rb
def logged_in?
  !!current_user
end

def authorized?
  current_user.login == "admin"
end

# app/controllers/application.rb
class ApplicationController &lt; ActionController::Base
  include AuthenticatedSystem
end
</code></pre>

<p>What gives?</p>

Right, so I still  don't understand why that wasn't working, but I have found an alternative solution.
(1) Leave authenticated_system.rb as is.
(2) Add a helper method to controllers/application.rb:
```
```
helper_method :is_admin?
def is_admin?
  if logged_in? && current_user.login == "admin"
    true
  else
    false
  end
end
```
```
(3) Use the helper method instead of
```
authorized?
```
.  If anyone would like to explain why the original code wasn't working, I'm all ears!
(Thanks to
this post
)