anotherjesse (owner)

Revisions

gist: 98798 Download_button fork
public
Description:
an attempt to make a ranged named_proxy
Public Clone URL: git://gist.github.com/98798.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
class ActiveRecord::Base
  named_scope :created, lambda { |date_range|
    case date_range
    when Range
      {:conditions => ["date(created_at) in (?)", date_range]}
    when Date
      {:conditions => ["date(created_at) = ?", date_range]}
    else
      {:conditions => '1=1'}
    end
  }
end