No release in over 3 years
Low commit activity in last 3 years
A collection of time scopes for activerecord, including created_after/created_before/updated_after/etc
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 5.2.3
 Project Readme

Activerecord Time Scopes

A simple gem that allows some of the most common time-scopes for ActiveRecord objects.

Installation

Add this line to your application's Gemfile:

gem 'activerecord_time_scopes', '>= 0.0.1'

And then execute:

$ bundle

Or install it yourself as:

$ gem install activerecord_time_scopes

Usage

This plugin enables the following methods:

[created | updated] _ [before | after | between | today | yesterday | this_week | last_week | this_month | last_month | this_year | last_year]

You can pass either datetime objects or ActiveRecord objects - if you pass an activerecord object, the relevant method (created/updated_at) will be used to search.

Some Examples:

SomeModel.created_after(Time.zone.now - 4.days)
SomeModel.updated_before(Time.zone.now)
SomeRecord.created_after(@user)
User.updated_between(Time.zone.now - 3.days, Time.zone.now - 2.days)
Order.created_today
Order.created_yesterday
Account.created_this_year
Account.created_last_year

License

The gem is available as open source under the terms of the MIT License.