Class: BucketRate

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/bucket_rate.rb

Instance Method Summary collapse

Instance Method Details

#<=>(other) ⇒ Object



25
26
27
# File 'app/models/bucket_rate.rb', line 25

def <=>(other)
  self.floor <=> other.floor
end

#unitObject



15
16
17
# File 'app/models/bucket_rate.rb', line 15

def unit
  calculator && calculator.unit
end

#validateObject



19
20
21
22
23
# File 'app/models/bucket_rate.rb', line 19

def validate
  if !ceiling.blank? && !floor.blank? && ceiling.to_i < floor.to_i
    errors.add(:ceiling, :higher_or_equal)
  end
end