Module: BooleanField::ClassMethods

Defined in:
app/models/concerns/boolean_field.rb

Instance Method Summary collapse

Instance Method Details

#boolean_field(name, default = true) ⇒ Object



4
5
6
7
8
9
# File 'app/models/concerns/boolean_field.rb', line 4

def boolean_field(name, default = true)
  if RocketCMS.mongoid?
    field name, type: Mongoid::Boolean, default: default
  end
  scope name, -> { where(name => true) }
end