app/models/booking.rb~ in has_accounts-0.8.2 vs app/models/booking.rb~ in has_accounts-0.8.3
- old
+ new
@@ -62,37 +62,19 @@
begin
date = Date.parse(value)
rescue ArgumentError
end
- where("title LIKE :text OR comments = :text OR amount = :amount OR value_date = :value_date", :text => text, :amount => amount, :value_date => date)
+ where("title LIKE :text OR comments LIKE :text OR amount = :amount OR value_date = :value_date", :text => text, :amount => amount, :value_date => date)
}
# Returns array of all years we have bookings for
def self.fiscal_years
with_exclusive_scope do
select("DISTINCT year(value_date) AS year").all.map{|booking| booking.year}
end
end
- def self.scope_by_value_date(value_date)
- scoping = self.default_scoping - [@by_value_scope]
-
- @by_value_scope = {:find => {:conditions => {:value_date => value_date}}}
- scoping << @by_value_scope
-
- Thread.current["#{self}_scoped_methods"] = nil
- self.default_scoping = scoping
- end
-
- def self.filter(controller, &block)
- if controller.value_date_scope
- with_scope(:find => {:conditions => {:value_date => controller.value_date_scope}}, &block)
- else
- block.call
- end
- end
-
# Standard methods
def to_s(format = :default)
case format
when :short
"%s: %s / %s CHF %s" % [