Forum: Ferret ferret joins

Posted by 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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.