Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- returning(
- :select => "DISTINCT operator_shortcode_price_points.*, MAX(operator_shortcode_price_points.valid_from) AS valid_from",
- :order => "valid_from DESC",
- :group => "operator_shortcode_id, price_point_id"
- ) do |selekt|
- # Returns full list of current prices for operator/shortcode combination
- named_scope :current, { :conditions => "valid_from <= NOW()" }.merge(selekt)
- # Returns full list of prices on passed date for operator/shortcode combination
- #
- # OperatorShortcodePricePoint.on('2008-03-03') => array
- #
- named_scope :on, lambda { |date| { :conditions => ["valid_from <= ?", Date.parse(date)] }.merge(selekt) }
- end
Add Comment
Please, Sign In to add comment