Sha256: 020859baad8bc013b1d2f8c725df8b94c4a0762efd2418371885abba0a3c043e

Contents?: true

Size: 1.03 KB

Versions: 2

Compression:

Stored size: 1.03 KB

Contents

# Telescope

## Installation

Add this line to your application's Gemfile:

    gem 'telescope'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install telescope

## Usage

```ruby
create_table "events" do |t|
  t.string   "name"
  t.boolean  "special"
  t.datetime "expired_at"
end

class Event < ActiveRecord::Base
  acts_as_telescope
end

Event.special
# SELECT * FROM `events` where `events`.`special` = 1

Event.not_special
# SELECT * FROM `events` where `events`.`special` = 0

Time.now
# => 2013-07-05 15:43:42

Event.expired_before(2.months.ago)
# SELECT * FROM `events` where `events`.`expired_at` < '2013-05-05 15:43:42'

Event.expired_before_now
# SELECT * FROM `events` where `events`.`expired_at` < '2013-07-05 15:43:42'

Event.expired_after_or_at(2.months.from_now)
# SELECT * FROM `events` where `events`.`expired_at` >= '2013-09-05 15:43:42'

Event.expired_between(2.months.ago..1.month.from_now)
# SELECT * FROM `events` where `events`.`expired_at` BETWEEN '2013-05-05 15:43:42' AND '2013-08-05 15:43:42'
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
telescope-0.0.2 README.md
telescope-0.0.1 README.md