Niranjan Acharya Thu Nov 24 07:36:08 -0500 2011

Subject: Join, search and Sort

Hi friends,

I have a DB with lets say 3 tables. each table is associated with one of the columns. (NOTE: I am not using the table / column names as required by phpactiverecord i.e. plural forms and primary key = id)

I have created 3 models for each table and given all the settings required to pull the data. (tested individually).

I can display the records with data from all the 3 tables. (I can get this through the associations (belongs_to / has_many). e.g. lets say my primary model /table is 'Table A' so I do $data = TableA::all(); and I can access $data->TableB->column and $data->TableC->column.

I want to add search and the keywords or columns will span in all the three tables. So lets say I use TableA primarily to fetch the data and retrieve through the associations, how can I do a search on TableB / TableC.

please help. I tried all what I cud learn through the wiki and other part of the forum.

thanks in advance