]> git.openstreetmap.org Git - rails.git/blob - app/models/friendship.rb
Don't order by id when getting last records
[rails.git] / app / models / friendship.rb
1 # == Schema Information
2 #
3 # Table name: friends
4 #
5 #  id             :bigint(8)        not null, primary key
6 #  user_id        :bigint(8)        not null
7 #  friend_user_id :bigint(8)        not null
8 #  created_at     :datetime
9 #
10 # Indexes
11 #
12 #  index_friends_on_user_id_and_created_at  (user_id,created_at)
13 #  user_id_idx                              (friend_user_id)
14 #
15 # Foreign Keys
16 #
17 #  friends_friend_user_id_fkey  (friend_user_id => users.id)
18 #  friends_user_id_fkey         (user_id => users.id)
19 #
20
21 class Friendship < ApplicationRecord
22   self.table_name = "friends"
23
24   belongs_to :befriender, :class_name => "User", :foreign_key => :user_id
25   belongs_to :befriendee, :class_name => "User", :foreign_key => :friend_user_id
26 end