Class: ActiveRecord::Acts::Partitioned::Keys
- Inherits:
-
Array
- Object
- Array
- ActiveRecord::Acts::Partitioned::Keys
- Defined in:
- lib/active_record/acts/partitioned/keys.rb
Instance Method Summary collapse
- #column_names ⇒ Object
- #columns ⇒ Object
- #create_partition_tables(model, opts = {}) ⇒ Object
- #partition_handle(opts) ⇒ Object
-
#remaining_columns(column) ⇒ Object
Returns the list of column names excluding this one.
Instance Method Details
#column_names ⇒ Object
9 10 11 |
# File 'lib/active_record/acts/partitioned/keys.rb', line 9 def column_names self.map { |k| k.column_names }.flatten end |
#columns ⇒ Object
5 6 7 |
# File 'lib/active_record/acts/partitioned/keys.rb', line 5 def columns self.map(&:column) end |
#create_partition_tables(model, opts = {}) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/active_record/acts/partitioned/keys.rb', line 18 def create_partition_tables(model, opts = {}) each_with_index do |key, index| key_opts = index == 0 ? opts : opts.merge(:parent => self[index - 1]) key.create_partition_table(model, key_opts) end end |
#partition_handle(opts) ⇒ Object
25 26 27 |
# File 'lib/active_record/acts/partitioned/keys.rb', line 25 def partition_handle(opts) map { |k| k.partition_handle(opts) }.join("_") end |
#remaining_columns(column) ⇒ Object
Returns the list of column names excluding this one
14 15 16 |
# File 'lib/active_record/acts/partitioned/keys.rb', line 14 def remaining_columns(column) self.column_names - [column] end |