lib/locomotive/mongoid/patches.rb in locomotive_cms-2.0.3 vs lib/locomotive/mongoid/patches.rb in locomotive_cms-2.1.0

- old
+ new

@@ -1,29 +1,29 @@ # encoding: utf-8 require 'mongoid' +class RawArray < ::Array + def resizable?; false; end +end + +# FIXME: we have serialiez templates which have references to the old BSON::ObjectId class. +module BSON + class ObjectId < Moped::BSON::ObjectId; end + # class Binary < Moped::BSON::Binary; end +end + module Mongoid#:nodoc: module Document #:nodoc: def as_json(options = {}) attrs = super(options) attrs["id"] = attrs["_id"] attrs end end - module Fields #:nodoc: - module Internal #:nodoc: - class RawArray < Mongoid::Fields::Internal::Array - def resizable?; false; end - end - end - - class RawArray < ::Array; end - end - class Criteria def to_liquid Locomotive::Liquid::Drops::ProxyCollection.new(self) end end @@ -51,23 +51,23 @@ class ExclusionValidator < ActiveModel::Validations::ExclusionValidator include Localizable end - class UniquenessValidator < ActiveModel::EachValidator + # class UniquenessValidator < ActiveModel::EachValidator - def to_validate_with_localization(document, attribute, value) - field = document.fields[attribute.to_s] - if field.try(:localized?) - # no need of the translations, just the current value - value = document.send(attribute.to_sym) - end - to_validate_without_localization(document, attribute, value) - end + # def to_validate_with_localization(document, attribute, value) + # field = document.fields[attribute.to_s] + # if field.try(:localized?) + # # no need of the translations, just the current value + # value = document.send(attribute.to_sym) + # end + # to_validate_without_localization(document, attribute, value) + # end - alias_method_chain :to_validate, :localization + # alias_method_chain :to_validate, :localization - end + # end module ClassMethods def validates_exclusion_of(*args) validates_with(ExclusionValidator, _merge_attributes(args)) end