Sha256: 7ebd74f881de2e1abb4a5967dd4d94d4a0a1c30e8cd9124dcc5257a6d959b51a

Contents?: true

Size: 280 Bytes

Versions: 156

Compression:

Stored size: 280 Bytes

Contents

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

Version data entries

156 entries across 156 versions & 1 rubygems

Version Path
rocket_cms-0.19.2 app/models/concerns/boolean_field.rb
rocket_cms-0.19.1 app/models/concerns/boolean_field.rb
rocket_cms-0.19.0 app/models/concerns/boolean_field.rb
rocket_cms-0.18.5 app/models/concerns/boolean_field.rb
rocket_cms-0.18.4 app/models/concerns/boolean_field.rb
rocket_cms-0.18.3 app/models/concerns/boolean_field.rb
rocket_cms-0.18.2 app/models/concerns/boolean_field.rb
rocket_cms-0.18.1 app/models/concerns/boolean_field.rb
rocket_cms-0.18.0 app/models/concerns/boolean_field.rb
rocket_cms-0.17.2 app/models/concerns/boolean_field.rb
rocket_cms-0.17.1 app/models/concerns/boolean_field.rb
rocket_cms-0.17.0 app/models/concerns/boolean_field.rb
rocket_cms-0.16.1 app/models/concerns/boolean_field.rb
rocket_cms-0.16.0 app/models/concerns/boolean_field.rb
rocket_cms-0.15.5 app/models/concerns/boolean_field.rb
rocket_cms-0.15.4 app/models/concerns/boolean_field.rb
rocket_cms-0.15.3 app/models/concerns/boolean_field.rb
rocket_cms-0.15.2 app/models/concerns/boolean_field.rb
rocket_cms-0.15.1 app/models/concerns/boolean_field.rb
rocket_cms-0.15.0 app/models/concerns/boolean_field.rb