I have two named scopes... both which work separately, but when combined do not work.
named_scope :total, :select => "COUNT(*) as days, AVG(price) as price, SUM(price) AS total", :group => :parent_id
named_scope :currency, lambda { |code| { :select => "*, price * #{(CurrencyRate.get_rate("USD", (code ||= "USD") ,1))} AS price" } }
Example:
c=Booking.total.currency("EUR").find_all_by_parent_id(63)
The total named scope works but not the currency...
c=Booking.currency("EUR").total.find_all_by_parent_id(63)
The currency named scope works but not the totals...
Any ideas?