Sha256: e63c2cb5649f9603d24cf225d83430c4b1fee5cadeab3e94f8b028f50d6d2ca6

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

module Shared
  def conditions_for_range(start_time, end_time, field="created_at")
    field = connection.quote_table_name(table_name) << '.' << connection.quote_column_name(field || "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

1 entries across 1 versions & 1 rubygems

Version Path
by_star-0.4.0 lib/shared.rb