retrospring/app/models/relationship.rb

9 lines
248 B
Ruby
Raw Normal View History

2020-04-19 00:59:18 +02:00
class Relationship < ApplicationRecord
2014-11-30 14:43:35 +01:00
belongs_to :source, class_name: 'User'
belongs_to :target, class_name: 'User'
validates :source_id, presence: true
validates :target_id, presence: true
2014-12-14 14:58:29 +01:00
default_scope { order(created_at: :asc) }
2014-11-30 14:06:05 +01:00
end