Project

lifespan

0.0
No commit activity in last 3 years
No release in over 3 years
provides filtering of data at the start_at and end_at
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 4.4.0
>= 0
~> 10.0
~> 3.1.0

Runtime

< 5.0, >= 4.0.0
activesuport
< 5.0, >= 4.0.0
 Project Readme

Lifespan

Build Status

This +lifespan+ extension provides filtering of record at the start_at and end_at.
Automatically adding to default_scope.
without_lifespan method a good job.
It is not erased only default_scope itself has added.

Installation

Add this line to your application's Gemfile:

TODO: It is scheduled to be able to support rubygem install

gem 'lifespan'

or

gem 'lifespan', github: 'gendosu/lifespan'

And then execute:

$ bundle

Or install it yourself as:

$ gem install lifespan

Usage

class Article < ActiveRecord::Base
  lifespan start_at_column: "start_on"
end

How to use:

Article.all
=> SELECT
    `articles`.*
  FROM
    `articles`
  WHERE
    (`articles`.`start_at` <= '2115-03-31 15:00:00.000072') AND
    (`articles`.`end_at` > '2115-03-31 15:00:00.000072' OR `articles`.`end_at` IS NULL);

Development

TODO

After checking out the repo, run bin/setup to install dependencies. Then, run bin/console for an interactive prompt that will allow you to experiment.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request