-
Notifications
You must be signed in to change notification settings - Fork 482
/
curriculum_reference.rb
48 lines (45 loc) · 1.26 KB
/
curriculum_reference.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# == Schema Information
#
# Table name: levels
#
# id :integer not null, primary key
# game_id :integer
# name :string(255) not null
# created_at :datetime
# updated_at :datetime
# level_num :string(255)
# ideal_level_source_id :integer
# solution_level_source_id :integer
# user_id :integer
# properties :text(65535)
# type :string(255)
# md5 :string(255)
# published :boolean default(FALSE), not null
# notes :text(65535)
#
# Indexes
#
# index_levels_on_game_id (game_id)
# index_levels_on_name (name)
#
class CurriculumReference < Level
serialized_attrs %w(
reference
teacher_markdown
)
def self.create_from_level_builder(params, level_params)
create!(
level_params.merge(
user: params[:user],
game: Game.curriculum_reference,
level_num: 'custom',
)
)
end
# Get the URL of the studio.code.org/docs routes (that serves as a proxy to
# our docs.code.org route)
def href
return nil unless properties['reference']
"/docs#{properties['reference']}"
end
end