Class: Course
Class Method Summary
collapse
Instance Method Summary
collapse
aggregate_of, all_except, defaults, numbered, #save, #save_and_notify!, #save_and_notify_changes!, serialize_symbolized_hash_array, #update_and_notify!, update_or_create!, whitelist_attributes
Class Method Details
.import_from_resource_h!(resource_h) ⇒ Object
8
9
10
11
|
# File 'app/models/course.rb', line 8
def self.import_from_resource_h!(resource_h)
json = Mumukit::Platform::Course::Helpers.slice_platform_json resource_h
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
|