Module: Mongoid::ForceBoolean::ClassMethods

Defined in:
lib/force_boolean.rb

Instance Method Summary collapse

Instance Method Details

#boolean_fieldsObject



35
36
37
38
# File 'lib/force_boolean.rb', line 35

def boolean_fields
  return @boolean_fields if defined?(@boolean_fields)
  @boolean_fields = fields.select { |_, field| field.type == ::Boolean }.keys
end

#has_boolean_field?Boolean



40
41
42
# File 'lib/force_boolean.rb', line 40

def has_boolean_field?
  !boolean_fields.empty?
end