Forum: Ferret ferret joins

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
32d23e114a9e523727efe0e1042732ce?d=identicon&s=25 Wesley Elder (wesleyelder)
on 2009-02-10 18:18
Hey everyone,

just a quick question about ferret and joins.

i have two models

[code]
class Option < ActiveRecord::Base
  require 'acts_as_ferret'
  acts_as_ferret :fields => [:sym, :description, :opra_root]
end


and

class Sym < ActiveRecord::Base
  require 'acts_as_ferret'
  acts_as_ferret :fields => [:sym, :description], :ferret =>
{:max_clauses => 5000}
end
[/code]

the sym model has many options.

So i just want to know if i can use :joins when calling

[code]
query = "y*"
options = Hash.new
      options[:select] = " options.opra_root, S.security_type, S.sym,
S.description as decs"
      options[:joins] = " as options INNER JOIN syms as S ON S.sym =
options.underlying_symbol"

Option.find_with_ferret(query, {}, options)
[/code]

Currently total_hits returns the correct value but length is always 0

Im very confused

Thanks
Wes
This topic is locked and can not be replied to.