module Sequel::Plugins::Polymorphic::DatasetMethods
Public Instance Methods
where(*cond, &block)
click to toggle source
Calls superclass method
# File lib/sequel/plugins/polymorphic.rb, line 14 def where(*cond, &block) if cond.first.is_a? Hash cond.first.clone.each do |key, value| # Does it respnd to #pk ? Then it's a model next unless value.respond_to?("pk") next unless self.model.association_reflections.key?(key.to_sym) next unless self.model.association_reflections[key.to_sym].key?(:polymorphic) next unless self.model.association_reflections[key.to_sym][:polymorphic] cond.first.delete(key) cond.first["#{key}_id".to_sym] = value.pk cond.first["#{key}_type".to_sym] = value.class.to_s end end super end