Sha256: 50a92dd384825a45407b62344ca0d64734ee8da31be97fb79a0ec914b60af98d
Contents?: true
Size: 985 Bytes
Versions: 21
Compression:
Stored size: 985 Bytes
Contents
module Partitioned # Partitioned abstract class for all partitioned models based as a single integer field value that is used as a foreign key class ByForeignKey < ByIntegerField self.abstract_class = true # the field to partition on # @return [Integer] re-routed to {#self.partition_foreign_key} def self.partition_integer_field return partition_foreign_key end # the field to partition on # @return [String] the name of the foreign key field def self.partition_foreign_key raise MethodNotImplemented.new(self, :partition_foreign_key) end partitioned do |partition| partition.foreign_key lambda {|model, foreign_key_value| return Configurator::Data::ForeignKey.new(model.partition_foreign_key, ActiveSupport::Inflector::pluralize(model.partition_foreign_key.to_s.sub(/_id$/,'')), :id) } end end end
Version data entries
21 entries across 21 versions & 1 rubygems