No commit activity in last 3 years
No release in over 3 years
Add time_as_boolean feature to ActiveRecord classes
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 4.0.4
~> 0.5.1
~> 0.6
~> 1.7.7
>= 0
~> 1.3.3

Runtime

 Project Readme

ActAsTimeAsBoolean

Build Status Gem Version Code Climate Dependency Status Coverage Status

Add time_as_boolean feature to your ruby classes

Installation

Ruby 1.9.3+, 2+

gem 'act_as_time_as_boolean'

Ruby 1.9.2

gem 'act_as_time_as_boolean', '~> 0.4.0'

Usage

class Item < ActiveRecord::Base
  include ActAsTimeAsBoolean

  attr_accessor :active_at

  time_as_boolean :active, opposite: :inactive
end

item = Item.new

item.active?
#=> false

item.inactive?
#=> true

item.active = true

item.active?
#=> true

item.inactive?
#=> false

Item.active
#=>  #<ActiveRecord::Relation [...]>

Item.inactive
#=>  #<ActiveRecord::Relation [...]>

Contributing

Contributors and CONTRIBUTING

Licence

Released under the MIT License. See the LICENSE file for further details.