app/models/user.rb
# find app friends. instance method for actual user and class method for logged in users
find app friends. instance method for actual user and class method for logged in users
find app friends . instance method for actual user and class method for logged in users
def app_friends
    Friend.where("user_id_giver = ?", user_id).includes(:friend).find_all do |f|
      if f.app_friend == 'Y'
        true
      elsif f.app_friend == nil and f.api_friend == 'Y'
        true
      else
        false
      end
    end 
  end
def app_friends Friend . where ( "user_id_giver = ?" , user_id ) . includes ( :friend ) . find_all do | f | if f . app_friend == 'Y' true elsif f . app_friend == nil and f . api_friend == 'Y' true else false end end end
find app friends.
find app friends .
# logger.debug2  "user_id_receiver = #{f.user_id_receiver}, api_friend = #{f.api_friend}, app_friend = #{f.app_friend}" # find all