sms-pager/app/controllers/relationships_controller.rb

20 lines
480 B
Ruby
Raw Normal View History

2015-10-03 08:04:16 -05:00
class RelationshipsController < ApplicationController
def add_child
parent = Person.find(params[:parent])
child = Child.find(params[:child])
parent.parenthoods.create(child)
redirect_to :back, notice: 'Child added to parent!'
end
def del_child
parent = Person.find(params[:parent])
child = Child.find(params[:child])
parent.parenthoods.find_by_child_id(child.id).destroy
redirect_to :back, notice: 'Child removed from parent!'
end
end