Module: Partitionable::ActsAsPartitionable::LocalInstanceMethods

Defined in:
lib/partitionable/acts_as_partitionable.rb

Instance Method Summary collapse

Instance Method Details

#create_partition_from_recordObject



131
132
133
134
135
136
137
138
# File 'lib/partitionable/acts_as_partitionable.rb', line 131

def create_partition_from_record
  return if has_partition?

  month = self.send(self.class.logdate_attr.to_sym).month
  year = self.send(self.class.logdate_attr.to_sym).year
  self.class.create_partition(month,year)
  self.class.update_trigger
end

#has_partition?Boolean

Returns:

  • (Boolean)


125
126
127
128
129
# File 'lib/partitionable/acts_as_partitionable.rb', line 125

def has_partition?
  month = self.send(self.class.logdate_attr.to_sym).month
  year = self.send(self.class.logdate_attr.to_sym).year
  self.class.partition_exists? month,year
end