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.8.9 lib/mobility/active_record/translation.rb
mobility-0.8.8 lib/mobility/active_record/translation.rb
mobility-0.8.7 lib/mobility/active_record/translation.rb
mobility-0.8.6 lib/mobility/active_record/translation.rb
mobility-0.8.5 lib/mobility/active_record/translation.rb
mobility-0.8.4 lib/mobility/active_record/translation.rb
mobility-0.8.3 lib/mobility/active_record/translation.rb
mobility-0.8.2 lib/mobility/active_record/translation.rb
mobility-0.8.1 lib/mobility/active_record/translation.rb
mobility-0.8.0 lib/mobility/active_record/translation.rb
mobility-0.7.6 lib/mobility/active_record/translation.rb
mobility-0.7.5 lib/mobility/active_record/translation.rb
mobility-0.7.4 lib/mobility/active_record/translation.rb
mobility-0.7.3 lib/mobility/active_record/translation.rb
mobility-0.7.2 lib/mobility/active_record/translation.rb
mobility-0.7.1 lib/mobility/active_record/translation.rb
mobility-0.7.0 lib/mobility/active_record/translation.rb
mobility-0.6.0 lib/mobility/active_record/translation.rb
mobility-0.5.1 lib/mobility/active_record/translation.rb
mobility-0.5.0 lib/mobility/active_record/translation.rb