ActAsTimeAsBoolean
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
Licence
Released under the MIT License. See the LICENSE file for further details.