Sha256: c1ba5336fba4d324d4c1e1e6c3a2861ead1aeaa59aeb3e5bfd83e47297e96fe9
Contents?: true
Size: 594 Bytes
Versions: 26
Compression:
Stored size: 594 Bytes
Contents
class Course < ApplicationRecord include Mumukit::Platform::Course::Helpers validates_presence_of :slug, :shifts, :code, :days, :period, :description, :organization_id validates_uniqueness_of :slug belongs_to :organization def self.import_from_json!(json) json = Mumukit::Platform::Course::Helpers.slice_platform_json json where(slug: json[:slug]).update_or_create!(json) end def slug=(slug) s = Mumukit::Auth::Slug.parse(slug) self[:slug] = slug self[:code] = s.course self[:organization_id] = Organization.find_by!(name: s.organization).id end end
Version data entries
26 entries across 26 versions & 1 rubygems