12 lines
252 B
Ruby
12 lines
252 B
Ruby
|
class Child < ActiveRecord::Base
|
||
|
has_many :parenthoods
|
||
|
has_many :parents, through: :parenthoods, source: :person
|
||
|
|
||
|
validates :first_name, presence: true
|
||
|
validates :last_name, presence: true
|
||
|
|
||
|
def name
|
||
|
"#{first_name} #{last_name}"
|
||
|
end
|
||
|
end
|