lib/shared.rb in by_star-0.7.1 vs lib/shared.rb in by_star-0.7.2
- old
+ new
@@ -1,7 +1,8 @@
module Shared
- def conditions_for_range(start_time, end_time, field="created_at")
- field = table_name << '.' << (field ? field.to_s : "created_at")
+ def conditions_for_range(start_time, end_time, field=nil)
+ field = table_name << '.' << field.to_s if field
+ field ||= by_star_field
["#{field} >= ? AND #{field} <= ?", start_time.utc, end_time.utc]
end
private
def scoped_by(options=nil, &block)
\ No newline at end of file