Sha256: a102265e7e9733e246abe7570f903ade173d2f8e0dfb29d1a1e61fa2d81b5f2e
Contents?: true
Size: 622 Bytes
Versions: 12
Compression:
Stored size: 622 Bytes
Contents
module Cmor module Core module Model module LocalizationConcern extend ActiveSupport::Concern included do validates :locale, inclusion: { in: I18n.available_locales.map(&:to_s) }, allow_nil: true, allow_blank: true scope :for_locale, ->(locale = I18n.locale, options = {}) do options.reverse_merge!(include_without_locale: true) if options[:include_without_locale] where(locale: locale).or(where(locale: nil)) else where(locale: locale) end end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems