Module: Reform::Form::Mongoid
- Defined in:
- lib/reform/form/mongoid.rb
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- UniquenessValidator =
Class.new("::Mongoid::#{mongoid_namespace}::UniquenessValidator".constantize) do include Reform::Form::ORM::UniquenessValidator end
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'lib/reform/form/mongoid.rb', line 2 def self.included(base) base.class_eval do register_feature Reform::Form::Mongoid include Reform::Form::ActiveModel include Reform::Form::ORM extend ClassMethods end end |
.mongoid_is_4_or_more? ⇒ Boolean
30 31 32 |
# File 'lib/reform/form/mongoid.rb', line 30 def self.mongoid_is_4_or_more? Mongoid::VERSION.split('.').first.to_i >= 4 end |
.mongoid_namespace ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/reform/form/mongoid.rb', line 22 def self.mongoid_namespace if mongoid_is_4_or_more? 'Validatable' else 'Validations' end end |