Hi,

When i search *active* it is not filtering result and doesn't give me 
error. *active* is a field in another table (roles). rolepid is an array of 
integer with the person ids.
Why is it not returning the 29 records from rolepid array ? 

What am i missing?


*model *

> class Person < ActiveRecord::Base
>   attr_accessible :alignment, :description, :first_name, :last_name
>   has_many :roles    #table roles with active as one of the field with value 
> equal t or f (boolean)end    
> class Role < ActiveRecord::Base
>   attr_accessible :active, :organization_id, :person_id, :position_id
>   belongs_to :person 
>   belongs_to :organization 
>   belongs_to :positionend   
>
>
*person_index.rb* 

>
>  ThinkingSphinx::Index.define :person, :with => :active_record, :delta => 
> true do
> #Fields
>   indexes last_name, :sortable => true
>   indexes first_name, :sortable => true
>   indexes alignment
>   
> #Attributes
>   has created_at, updated_at
>   has professions(:id), :as => :profession_ids
>   has positions(:id), :as => :position_id
>   has organizations(:id), :as => :organization_id
>   
>   has '6', :as => :model_order, :type => :integer
>
> end
>
>



*people_controller*
>
> if params[:active].present?
>   role = Array.new
>   rolepid = Array.new
>   role = Role.find_all_by_active(params[:active])
>   role.each do |num|
>     rolepid << num.person_id
>   end
> end
>

filters[:id] = rolepid if params[:active].present?
>
> @people = Person.search " #{params[:lastname]} #{params[:firstname]} 
> #{params[:alignment]}", 
>   :with     => filters,
>   :star => true, 
>   :condition =>  { :alignment => params[:alignment], }, #:lastname => 
> params[:lastname], :firstname => params[:firstname],
>   :order => 'last_name ASC, first_name ASC',
>   :page     => params[:page], 
>   :per_page => 20 
>


 

-- 
You received this message because you are subscribed to the Google Groups 
"Thinking Sphinx" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/thinking-sphinx.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to