Question: Not sure what's wrong. I've tried removing the space between the < and % but the app wouldn't run.

```
< % if logged_in? %>  
  Welcome < %= current_user.username %>! Not you?  
  < %= link_to "Log out", logout_path %>  
< % else %>  
  < %= link_to "Sign up", signup_path %> or  
  < %= link_to "log in", login_path %>.  
< % end %>  

```

The error I get is:

```
NoMethodError in Posts#index undefined method `logged_in?' for #<#<Class:0x00000101ab0250>:0x00000101aab0c0> 

```

![enter image description here](https://i.stack.imgur.com/pD4yV.png)

Answer: 
Did you mean :

```
 <% if current_user.logged_in? %> 

```

Your current piece of code will try to use the logged\_in? helper wich i guess is not what you want.
If you are using the "restful\_authentication", trying adding `include AuthenticatedSystem` like below

```
#app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  include AuthenticatedSystem
  .....

```

`logged_in?` is a protected method inside the AuthenticatedSystem module

```
module AuthenticatedSystem
  protected
    # Returns true or false if the <%= file_name %> is logged in.
    # Preloads @current_<%= file_name %> with the <%= file_name %> model if they're logged in.
    def logged_in?
      !!current_<%= file_name %>
    end
    ......

```

HTH