Create some DifficultyLevels by default
This commit is contained in:
parent
fe35f1d788
commit
9c968ad3e2
1 changed files with 17 additions and 0 deletions
|
|
@ -101,6 +101,7 @@ class Conference < ActiveRecord::Base
|
||||||
validates_format_of :short_title, with: /\A[a-zA-Z0-9_-]*\z/
|
validates_format_of :short_title, with: /\A[a-zA-Z0-9_-]*\z/
|
||||||
before_create :generate_guid
|
before_create :generate_guid
|
||||||
before_create :create_event_types
|
before_create :create_event_types
|
||||||
|
before_create :create_difficulty_levels
|
||||||
before_create :create_email_settings
|
before_create :create_email_settings
|
||||||
before_create :add_color
|
before_create :add_color
|
||||||
|
|
||||||
|
|
@ -897,6 +898,22 @@ class Conference < ActiveRecord::Base
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
##
|
||||||
|
# Creates default DifficultyLevels for this Conference. Used as before_create.
|
||||||
|
#
|
||||||
|
def create_difficulty_levels
|
||||||
|
difficulty_levels << DifficultyLevel.create(title: 'Easy',
|
||||||
|
description: 'Events are understandable for everyone without knowledge of the topic.',
|
||||||
|
color: '#70EF69')
|
||||||
|
difficulty_levels << DifficultyLevel.create(title: 'Medium',
|
||||||
|
description: 'Events require a basic understanding of the topic.',
|
||||||
|
color: '#EEEF69')
|
||||||
|
difficulty_levels << DifficultyLevel.create(title: 'Hard',
|
||||||
|
description: 'Events require expert knowledge of the topic.',
|
||||||
|
color: '#EF6E69')
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Creates a EmailSettings association proxy. Used as before_create.
|
# Creates a EmailSettings association proxy. Used as before_create.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue