Class: Course
Class Method Summary
collapse
Instance Method Summary
collapse
aggregate_of, all_except, defaults, name_model_as, numbered, #save, #save_and_notify!, #save_and_notify_changes!, #update_and_notify!, update_or_create!
Class Method Details
.import_from_json!(json) ⇒ Object
8
9
10
11
|
# File 'app/models/course.rb', line 8
def self.import_from_json!(json)
json = Mumukit::Platform::Course::Helpers.slice_platform_json json
where(slug: json[:slug]).update_or_create!(json)
end
|
Instance Method Details
#slug=(slug) ⇒ Object
13
14
15
16
17
18
19
|
# File 'app/models/course.rb', line 13
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
|