Sha256: 64f4c396c952eae29323395f3536c686ed7cb6244ec05525a0560f449b044986
Contents?: true
Size: 677 Bytes
Versions: 39
Compression:
Stored size: 677 Bytes
Contents
class Invitation < ApplicationRecord def self.find_by_code(code) Invitation .where(code: code) .where(Invitation.arel_table[:expiration_date].gt(Time.now)) .take! rescue RangeError raise RecordNotFound.new('The invitation does not exist or it has expired') end def self.import_from_json!(json) Invitation.create! json end def organization Organization.find_by! name: course.to_mumukit_slug.organization end def navigable_name I18n.t(:invitation_for, course: course_name) end def navigation_end? true end def to_param code end private def course_name course.to_mumukit_slug.course end end
Version data entries
39 entries across 39 versions & 1 rubygems