Sha256: b20ac4a17168c77a05c83987e0331adb994743b35036dc58b1e6873718b6ca3b

Contents?: true

Size: 240 Bytes

Versions: 5

Compression:

Stored size: 240 Bytes

Contents

module BooleanField
  extend ActiveSupport::Concern
  module ClassMethods
    def boolean_field(name, default = true)
      field name, type: Mongoid::Boolean, default: default
      scope name, -> { where(name => true) }
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rocket_cms-0.4.2 app/models/concerns/boolean_field.rb
rocket_cms-0.3.2 app/models/concerns/boolean_field.rb
rocket_cms-0.2.12 app/models/concerns/boolean_field.rb
rocket_cms-0.2.10 app/models/concerns/boolean_field.rb
rocket_cms-0.1.13 app/models/concerns/boolean_field.rb