puls
unread,Nov 6, 2009, 8:52:43 AM11/6/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Thinking Sphinx
Hi Pat,
I have following models:
class User < ActiveRecord::Base
has_many :bundles, :dependent => :destroy
has_many :items, :dependent => :destroy
has_many :credits, :dependent => :destroy
end
class Bundle < ActiveRecord::Base
belongs_to :user
has_many :items, :dependent => :destroy
end
class Item < ActiveRecord::Base
belongs_to :user
belongs_to :bundle
has_many :credits, :dependent => :destroy
end
class Credit < ActiveRecord::Base
belongs_to :user
belongs_to :item
belongs_to :bundle
define_index do
# fields
indexes item(:name), :as => :item_name, :sortable => true
indexes item.manufacturer, :as => :item_manufacturer
indexes item.keywords, :as => :item_keywords
indexes item.description, :as => :item_description
indexes user.city, :as => :user_city
indexes user.state, :as => :user_state
indexes user.zip_code, :as => :user_zip_code
# attributes
has item_id
has user_id
has token_face_value
has expire
set_property :delta => true # for generating indexes automatically
end
end
Now as you can see in above relationships one user has many bundles
and one bundle has many items.So, I want to define indexing like
"bundle.items(:name)"
I did some fixing but unfortunately it is not working :(
Can you please tell me that does indexing support this type of
relationship? If yes, how?
Thanks & Regards,
Pulkit J. Pancholi