Displaying 1 result from an estimated 1 matches for "level_for_posit".
2006 Apr 05
0
Is this model ordering logical or crazy?
...erent  
levels of product data, including:
Make, Product Range, Model, Derivative.  There''s a RuleLevel class to  
represent each level and has a column position.  It looks something  
like this:
class RuleLevel < ActiveRecord::Base
   include Comparable
   def +(offset)
     RuleLevel.level_for_position(position + offset)
   end
   def -(offset)
     RuleLevel.level_for_position(position - offset)
   end
   def <=>(other)
     return -(position <=> other.position)
   end
   private
     def self.level_for_position(position)
       StockRuleLevel.find(:first, :conditions => &qu...