class PriceLogEntry
Public Instance Methods
pretty_print()
click to toggle source
# File lib/generators/price_log/templates/price_log_entry.rb, line 35 def pretty_print puts "#{self.priceable_type}, #{self.priceable_id}, #{self.priceable_field_name}, start_date: #{self.start_date}, end_date: #{self.end_date}" end
resolve_dates()
click to toggle source
# File lib/generators/price_log/templates/price_log_entry.rb, line 21 def resolve_dates _all_ = PriceLogEntry.all_for_priceable(self.priceable_type, self.priceable_id, self.priceable_field_name) prev_start_date = nil self.logger.info "Recalculates #{self.priceable_type}, #{self.priceable_id}, #{self.priceable_field_name}" _all_.order("start_date DESC").each do |ple| unless prev_start_date.nil? ple.end_date = prev_start_date ple.save! end prev_start_date = ple.start_date end true end