Hi Pat, Thank you for quick and correct response!
The functionality is working fine as you have said. Thanks & Regards, Pulkit J. Pancholi On Nov 7, 4:03 am, Pat Allan <[email protected]> wrote: > Hi Pulkit > > If the index is in Credit, then what you've suggested should work, if > you provide an alias: > indexes bundle.items(:name), :as => :bundle_items > > If you want to access the Credit user's bundle items, then this should > work instead: > indexes user.bundles.items(:name), :as => :user_bundle_items > > If you're still stuck, let me know. > > -- > Pat > > On 07/11/2009, at 12:52 AM, puls wrote: > > > > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Thinking Sphinx" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/thinking-sphinx?hl=en -~----------~----~----~----~------~----~------~--~---
