Sha256: bf78db5d4e919eb22751de7c2050c40354df91e3f2262535f028b827cb1c6a80

Contents?: true

Size: 426 Bytes

Versions: 5

Compression:

Stored size: 426 Bytes

Contents

module Shared
  def conditions_for_range(start_time, end_time, field="created_at")
    field = table_name << '.' << (field ? field.to_s : "created_at")
    ["#{field} >= ? AND #{field} <= ?", start_time.utc, end_time.utc]
  end
  
  private 
  def scoped_by(options=nil, &block)
    if options && scope = options.call
      with_scope(:find => scope) do
        block.call
      end
    else
      block.call
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
by_star-0.6.3 lib/shared.rb
by_star-0.6.2 lib/shared.rb
by_star-0.6.1 lib/shared.rb
by_star-0.6.0 lib/shared.rb
by_star-0.5.2 lib/shared.rb