lib/ransack/adapters/mongoid/context.rb in ransack-1.7.0 vs lib/ransack/adapters/mongoid/context.rb in ransack-1.8.0

- old
+ new

@@ -4,14 +4,10 @@ module Ransack module Adapters module Mongoid class Context < ::Ransack::Context - # Because the AR::Associations namespace is insane - # JoinDependency = ::Mongoid::Associations::JoinDependency - # JoinPart = JoinDependency::JoinPart - def initialize(object, options = {}) super # @arel_visitor = @engine.connection.visitor end @@ -98,10 +94,18 @@ else raise ArgumentError, "Don't know how to klassify #{obj}" end end + def lock_association(association) + warn "lock_association is not implemented for Ransack mongoid adapter" if $DEBUG + end + + def remove_association(association) + warn "remove_association is not implemented for Ransack mongoid adapter" if $DEBUG + end + private def get_parent_and_attribute_name(str, parent = @base) attr_name = nil @@ -130,10 +134,10 @@ ransackable_association?(str, klass) && klass.reflect_on_all_associations_all.detect { |a| a.name.to_s == str } end def join_dependency(relation) - if relation.respond_to?(:join_dependency) # Squeel will enable this + if relation.respond_to?(:join_dependency) # Polyamorous enables this relation.join_dependency else build_join_dependency(relation) end end