mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-08 04:15:18 +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
34 lines
1 KiB
Ruby
34 lines
1 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
class PostLocalization < ActiveRecord::Base
|
|
include LocaleMatchable
|
|
|
|
belongs_to :post
|
|
|
|
validates :post_version, presence: true
|
|
validates :locale, presence: true, length: { maximum: 20 }
|
|
validates :raw, presence: true
|
|
validates :cooked, presence: true
|
|
validates :localizer_user_id, presence: true
|
|
validates :locale, uniqueness: { scope: :post_id }
|
|
end
|
|
|
|
# == Schema Information
|
|
#
|
|
# Table name: post_localizations
|
|
#
|
|
# id :bigint not null, primary key
|
|
# post_id :integer not null
|
|
# post_version :integer not null
|
|
# locale :string(20) not null
|
|
# raw :text not null
|
|
# cooked :text not null
|
|
# localizer_user_id :integer not null
|
|
# created_at :datetime not null
|
|
# updated_at :datetime not null
|
|
#
|
|
# Indexes
|
|
#
|
|
# index_post_localizations_on_post_id (post_id)
|
|
# index_post_localizations_on_post_id_and_locale (post_id,locale) UNIQUE
|
|
#
|