2018-11-20 20:47:30 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-05-18 00:54:41 +05:30
|
|
|
class ProgrammingLanguage < ApplicationRecord
|
2018-11-18 11:00:15 +05:30
|
|
|
validates :name, presence: true
|
|
|
|
validates :color, allow_blank: false, color: true
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
# Returns all programming languages which match the given name (case
|
|
|
|
# insensitively).
|
|
|
|
scope :with_name_case_insensitive, ->(name) do
|
|
|
|
where(arel_table[:name].matches(sanitize_sql_like(name)))
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
end
|