module Approvable
  extend ActiveSupport::Concern
  
  included do
    def approve_by(user)
      return unless approved_at.nil?
  
      self.approved_by_user_name = user.full_name
      self.approved_by_user_email = user.email
      self.approved_at = Time.zone.now
    end
  
    def approved?
      self.approved_at.present?
    end
  end
end
