Sha256: 308c1857d88e10321e9e7305232ecb8efbaefe32f09982b79a2b1f9825a47685

Contents?: true

Size: 505 Bytes

Versions: 6

Compression:

Stored size: 505 Bytes

Contents

module Mobility
  module ActiveRecord
    # @abstract Subclass and set +table_name+ to implement for a particular column type.
    class Translation < ::ActiveRecord::Base
      self.abstract_class = true

      belongs_to :translatable, polymorphic: true, touch: true

      validates :key, presence: true, uniqueness: { scope: [:translatable_id, :translatable_type, :locale], case_sensitive: true }
      validates :translatable, presence: true
      validates :locale, presence: true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
mobility-1.0.0.beta2 lib/mobility/active_record/translation.rb
mobility-1.0.0.beta1 lib/mobility/active_record/translation.rb
mobility-1.0.0.alpha lib/mobility/active_record/translation.rb
mobility-0.8.13 lib/mobility/active_record/translation.rb
mobility-0.8.11 lib/mobility/active_record/translation.rb
mobility-0.8.10 lib/mobility/active_record/translation.rb