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.10.1 app/models/concerns/boolean_field.rb
rocket_cms-0.10.0 app/models/concerns/boolean_field.rb
rocket_cms-0.9.9 app/models/concerns/boolean_field.rb
rocket_cms-0.9.8 app/models/concerns/boolean_field.rb
rocket_cms-0.9.7 app/models/concerns/boolean_field.rb
rocket_cms-0.9.5 app/models/concerns/boolean_field.rb
rocket_cms-0.9.4 app/models/concerns/boolean_field.rb
rocket_cms-0.9.3 app/models/concerns/boolean_field.rb
rocket_cms-0.9.2 app/models/concerns/boolean_field.rb
rocket_cms-0.9.1 app/models/concerns/boolean_field.rb
rocket_cms-0.8.13 app/models/concerns/boolean_field.rb
rocket_cms-0.8.12 app/models/concerns/boolean_field.rb
rocket_cms-0.8.11 app/models/concerns/boolean_field.rb
rocket_cms-0.8.10 app/models/concerns/boolean_field.rb
rocket_cms-0.8.9 app/models/concerns/boolean_field.rb
rocket_cms-0.8.8 app/models/concerns/boolean_field.rb
rocket_cms-0.8.7 app/models/concerns/boolean_field.rb
rocket_cms-0.8.6 app/models/concerns/boolean_field.rb
rocket_cms-0.8.5 app/models/concerns/boolean_field.rb
rocket_cms-0.8.4 app/models/concerns/boolean_field.rb