Method: Spider::Model::Query#with_polymorph
- Defined in:
- lib/spiderfw/model/query.rb
#with_polymorph(type, request = nil) ⇒ self
Requests a polymorph. This means that the mapper will try to differentiate the result into the subclasses given here.
143 144 145 146 147 148 149 150 151 152 |
# File 'lib/spiderfw/model/query.rb', line 143 def with_polymorph(type, request=nil) query = self.class.new(query) unless query.is_a?(self.class) @polymorphs << type unless request request = Request.new type.primary_keys.each{ |k| request[k.name] = true } end @request.with_polymorphs(type, request) return self end |