metamaps--metamaps/app/models/access_request.rb
Connor Turland 4602ded8a4 access requests (#762)
* start on access requests

* set up access requests further

* set default values for approved and answered
2016-10-16 20:22:00 -04:00

18 lines
385 B
Ruby

class AccessRequest < ApplicationRecord
belongs_to :user
belongs_to :map
def approve
self.approved = true
self.answered = true
self.save
UserMap.create(user: self.user, map: self.map)
MapMailer.invite_to_edit_email(self.map, self.map.user, self.user).deliver_later
end
def deny
self.approved = false
self.answered = true
self.save
end
end