Add time_as_boolean feature to your ruby classes
gem 'act_as_time_as_boolean'
gem 'act_as_time_as_boolean', '~> 0.4.0'
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 [...]>
Released under the MIT License. See the LICENSE file for further details.