title: I keep getting a "undefined method `each' for nil:NilClass" on my amistad views. Can anyone tell me why?
body: <p>So I am trying to setup a view for my friendship model from Amistad, but I keep getting this error: "undefined method `each' for nil:NilClass"</p>
  
  <p>This is my friendship.rb model</p>
  
  <pre><code>class Friendship &lt; ActiveRecord::Base
    include Amistad::FriendshipModel
  
      attr_accessible :user_id, :friend_id
  end
  </code></pre>
  
  <p>This is my friendships_controller.rb</p>
  
  <pre><code>class FriendshipsController &lt; ApplicationController
    before_filter :authenticate_user!
  
    def index
      @friends = current_user.friends
      @pending_invited_by = current_user.pending_invited_by
      @pending_invited = current_user.pending_invited
    end
  
    def create
      @Friend = User.find(params[:user_id])
      @friendship_created = current_user.invite(@Friend)
    end
  
    def approve
      @Friend = User.find(params[:user_id])
      @friendship_approved = current_user.approve(@Friend)
      @friends = current_user.friends
      @pending_invited_by = current_user.pending_invited_by
    end
  
    def remove
      @Friend = User.find(params[:user_id])
      @friendship = current_user.send(:find_any_friendship_with, @Friend)
      if @friendship
        @friendship.delete
        @removed = true
      end
     end
    end
  </code></pre>
  
  <p>My user model user.rb</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    mount_uploader :avatar, AvatarUploader
    has_many :cereals, dependent: :destroy
  
    # Include default devise modules. Others available are:
    # :token_authenticatable, :confirmable,
    # :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable, :authentication_keys =&gt; [:login]
    include Amistad::FriendModel
  
    # Setup accessible (or protected) attributes for your model
    attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :login, :avatar, :avatar_cache, :remove_avatar, :firstname, :lastname, :phone, :urlname
    # attr_accessible :title, :body
  
    attr_accessor :login
  
    def self.find_first_by_auth_conditions(warden_conditions)
        conditions = warden_conditions.dup
        if login = conditions.delete(:login)
          where(conditions).where(["lower(username) = :value OR lower(email) = :value", { :value =&gt; login.downcase }]).first
        else
          where(conditions).first
        end
      end
  
              def update_with_password(params={})
          current_password = params.delete(:current_password)
  
          if params[:password].blank?
            params.delete(:password)
            params.delete(:password_confirmation) if params[:password_confirmation].blank?
          end
  
                  result = if params[:password].blank? || valid_password?(current_password) 
            update_attributes(params)
          else
            self.attributes = params
            self.valid?
            self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
            false
          end
  
          clean_up_passwords
          result
        end
      end
  </code></pre>
  
  <p>and users_controller.rb</p>
  
  <pre><code>class UsersController &lt; ApplicationController
      def show
        if params[:id].nil? &amp;&amp; current_user
          @user = current_user
        else
          @user = User.find(params[:id])
        end
        @cereal = current_user.cereals.build if signed_in?
        @cereals = @user.cereals.paginate(page: params[:page])
    end
  
    def first_time
        if params[:id].nil? &amp;&amp; current_user
          @user = current_user
        else
          @user = User.find(params[:id])
        end
    end
  
      def edit
          if params[:id].nil? &amp;&amp; current_user
              @user = current_user
          else
              @user = User.find(params[:id])
          end
    end
  
      def profile
          @username = params[:id]
          @title = "User Profile for #{@username}"
          @user = User.find_by_username(@username)
          @users = User.all :conditions =&gt; ["id != ?", current_user.id]
    end 
  
  end
  </code></pre>
  
  <p>Anyone have any idea whats going on? I am still new at rails, and could use some insight.</p>
  
  <p>The View:</p>
  
  <pre><code>.row
      #dashboard.span12
          = @user.username
          #profile_pic=link_to image_tag(@user.avatar, border: '0'), action: 'profile', controller: 'users'
      #bowl_outline.span9
          Bowl
  
      #friends.span3
          Friends
          %ul
          - for @user in @friends
              %li
                  - if current_user.friend_with? user
                      = user.username
                      |
                      You are already friends!
                  - elsif current_user.invited? user
                      = user.username
                      | 
                      Pending request ...
                  - elsif user.invited? current_user
                      = user.username
                      |
                      = link_to "Confirm friend?", friend_path(user), :method =&gt; "put"
                  - else
                      = user.username
                      = link_to "Add friend?", friends_path(:user_id =&gt; @user), :method =&gt; "post"
  </code></pre>