Sha256: e4ef72e6201a96c05a48a4e7588d7d239dedfd46ec58b932dc1673954f3b734c

Contents?: true

Size: 483 Bytes

Versions: 31

Compression:

Stored size: 483 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] }
      validates :translatable, presence: true
      validates :locale, presence: true
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
mobility-0.4.3 lib/mobility/active_record/translation.rb
mobility-0.4.2 lib/mobility/active_record/translation.rb
mobility-0.4.1 lib/mobility/active_record/translation.rb
mobility-0.4.0 lib/mobility/active_record/translation.rb
mobility-0.3.6 lib/mobility/active_record/translation.rb
mobility-0.3.5 lib/mobility/active_record/translation.rb
mobility-0.3.4 lib/mobility/active_record/translation.rb
mobility-0.3.3 lib/mobility/active_record/translation.rb
mobility-0.3.2 lib/mobility/active_record/translation.rb
mobility-0.3.1 lib/mobility/active_record/translation.rb
mobility-0.3.0 lib/mobility/active_record/translation.rb