mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-22 17:41:55 +08:00
This is the first in the series and helps prepare us for crawler_view. Existing tests should cover the use of these concerns. /t/160415
13 lines
298 B
Ruby
Vendored
13 lines
298 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module LocaleMatchable
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
scope :matching_locale,
|
|
->(locale) do
|
|
regionless_locale = locale.to_s.split("_").first
|
|
where("locale LIKE ?", "#{regionless_locale}%")
|
|
end
|
|
end
|
|
end
|