openstreetmap-website/app/models/friendship.rb
Andy Allan 1cf8fec58d Rename Friend model to Friendship
This better describes what the model represents, which is the relationship
between the two users.
2019-06-19 16:39:25 +02:00

25 lines
652 B
Ruby

# == Schema Information
#
# Table name: friends
#
# id :bigint(8) not null, primary key
# user_id :bigint(8) not null
# friend_user_id :bigint(8) not null
#
# Indexes
#
# friends_user_id_idx (user_id)
# user_id_idx (friend_user_id)
#
# Foreign Keys
#
# friends_friend_user_id_fkey (friend_user_id => users.id)
# friends_user_id_fkey (user_id => users.id)
#
class Friendship < ActiveRecord::Base
self.table_name = "friends"
belongs_to :befriender, :class_name => "User", :foreign_key => :user_id
belongs_to :befriendee, :class_name => "User", :foreign_key => :friend_user_id
end