Given a profile has a user, you should be able to traverse associations to get the values you want:
has user.test_users.score.value, :as => :scores has user.test_users.test.id, :as => :test_ids Not sure about all of those association and column names, mind you. Adjust as needed. Cheers -- Pat On 02/01/2012, at 3:59 PM, mohitnegi wrote: > Hi, > > In my database the relation is as follows > there is a user table, a profile table, tests table, tests_users table and a > score table. > > Now each user has a profile. each user can apply to many tests, that entry is > made in tests_users, and if the tests_users status is paid then it will have > a score for that test. > > So basically in tests_users combination of user_id and test_id are unique, > i.e a user can apply for a particular test only once. there is a unique > registration number for each tests_users, which is used in score table for > generating score. > > Now for a shortlisting criteria i am using sphinx in my application. > > Index is defined in profile table > but the problem is i am not able to integrate score and test in the index > as a particular user can have multiple scores and he can apply for as many > tests. > > Can anyone please help me over that. > > > -- > You received this message because you are subscribed to the Google Groups > "Thinking Sphinx" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/thinking-sphinx/-/HhhyqMHZxIwJ. > 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. -- 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.
