mirror of
https://github.com/openSUSE/osem.git
synced 2026-04-24 08:52:16 -04:00
The default colors in event_types and difficulty levels are in capital letters and the ones that comes from the color picker were not. Now colors are capitalized before saving the track, level or type. A rake task has also been created to capitalize color from old tracks, levels or types.
16 lines
320 B
Ruby
16 lines
320 B
Ruby
class DifficultyLevel < ActiveRecord::Base
|
|
belongs_to :program
|
|
has_many :events, dependent: :nullify
|
|
|
|
validates :title, presence: true
|
|
validates :color, format: /\A#[0-9A-F]{6}\z/
|
|
|
|
before_validation :capitalize_color
|
|
|
|
private
|
|
|
|
def capitalize_color
|
|
self.color = color.upcase if color.present?
|
|
end
|
|
end
|