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
#organization=(organization) ⇒ Object
18
19
20
21
|
# File 'app/models/course.rb', line 18
def organization=(organization)
self[:organization_id] = organization.id
self[:slug] = "#{organization.name}/#{code}"
end
|
#slug=(slug) ⇒ Object
13
14
15
16
|
# File 'app/models/course.rb', line 13
def slug=(slug)
self[:slug] = slug
self[:organization_id] = Organization.find_by(name: Mumukit::Auth::Slug.parse(slug).organization).id
end
|