module Parts::ModelMethods
Public Class Methods
allocate()
click to toggle source
# File lib/parts/model_methods.rb, line 19 def self.allocate superclass.allocate end
name()
click to toggle source
# File lib/parts/model_methods.rb, line 15 def self.name superclass.name end
new(*args, &blk)
click to toggle source
# File lib/parts/model_methods.rb, line 23 def self.new(*args, &blk) superclass.new(*args, &blk) end
Public Instance Methods
create_list_child(child_table_name, values)
click to toggle source
# File lib/parts/model_methods.rb, line 33 def create_list_child(child_table_name, values) transaction { connection.create_list_child_of(table_name, child_table_name, values) } end
create_range_child(child_table_name, start_range:, end_range:)
click to toggle source
# File lib/parts/model_methods.rb, line 29 def create_range_child(child_table_name, start_range:, end_range:) transaction { connection.create_range_child_of(table_name, child_table_name, start_range: start_range, end_range: end_range) } end
in_partition(child_table_name)
click to toggle source
# File lib/parts/model_methods.rb, line 11 def in_partition(child_table_name) Class.new(self) do self.table_name = child_table_name def self.name superclass.name end def self.allocate superclass.allocate end def self.new(*args, &blk) superclass.new(*args, &blk) end end end
partitions()
click to toggle source
# File lib/parts/model_methods.rb, line 5 def partitions connection.select_values <<~SQL SELECT inhrelid::regclass::text FROM pg_inherits WHERE inhparent = #{connection.quote(table_name)}::regclass; SQL end