#56 ✓resolved
kgiszczak

:finder_sql is wrongly interpreted

Reported by kgiszczak | February 23rd, 2009 @ 08:52 AM

Hi, I have problem with :finder_sql option when declaring association. Searchlogic interpretes it wrongly.


  class User < ActiveRecord::Base
    has_many :posts, :finder_sql => 'SELECT * FROM posts 
                                     WHERE status = \'published\''
  end

  controller:
  @search = current_user.posts
  @posts = @search.all

Query genereted by searchlogic is:


  SELECT * FROM posts WHERE(
      SELECT * FROM posts WHERE status = 'published')

Comments and changes to this ticket

  • Ben Johnson

    Ben Johnson February 23rd, 2009 @ 12:13 PM

    • State changed from “new” to “resolved”

    Associations with finder SQL shouldn't even be accessible since there is no way to chain conditions onto it, etc. I'm going to add that in now. Thanks.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Provides common named scopes and object based searching.

People watching this ticket

Pages