Create some DifficultyLevels by default

This commit is contained in:
Henne Vogelsang 2014-11-27 15:05:44 +01:00
parent fe35f1d788
commit 9c968ad3e2

View file

@ -101,6 +101,7 @@ class Conference < ActiveRecord::Base
validates_format_of :short_title, with: /\A[a-zA-Z0-9_-]*\z/
before_create :generate_guid
before_create :create_event_types
before_create :create_difficulty_levels
before_create :create_email_settings
before_create :add_color
@ -897,6 +898,22 @@ class Conference < ActiveRecord::Base
true
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.
#