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.37.1 app/models/concerns/boolean_field.rb
rocket_cms-0.37.0 app/models/concerns/boolean_field.rb
rocket_cms-0.36.0 app/models/concerns/boolean_field.rb
rocket_cms-0.35.0 app/models/concerns/boolean_field.rb
rocket_cms-0.34.0 app/models/concerns/boolean_field.rb
rocket_cms-0.33.1 app/models/concerns/boolean_field.rb
rocket_cms-0.33.0 app/models/concerns/boolean_field.rb
rocket_cms-0.32.0 app/models/concerns/boolean_field.rb
rocket_cms-0.31.1 app/models/concerns/boolean_field.rb
rocket_cms-0.31.0 app/models/concerns/boolean_field.rb
rocket_cms-0.30.0 app/models/concerns/boolean_field.rb
rocket_cms-0.29.0 app/models/concerns/boolean_field.rb
rocket_cms-0.28.0 app/models/concerns/boolean_field.rb
rocket_cms-0.27.8 app/models/concerns/boolean_field.rb
rocket_cms-0.27.7 app/models/concerns/boolean_field.rb
rocket_cms-0.27.6 app/models/concerns/boolean_field.rb
rocket_cms-0.27.5 app/models/concerns/boolean_field.rb
rocket_cms-0.27.4 app/models/concerns/boolean_field.rb
rocket_cms-0.27.3 app/models/concerns/boolean_field.rb
rocket_cms-0.27.2 app/models/concerns/boolean_field.rb