I have three tables associated and am trying to do a simple search.
User Table
ID | Name
User_Contacts Table
User_ID | Contact_ID | Updated_At
Contacts Table
ID | Name
I currently have my associations set up such that I can do the following
@contacts = @current_user.contacts
and have the User_Contacts table returned. I would like to keep it this way because I still need my updated_at attribute in my view.
Now what I need to do is some how search through the contacts table and find every contact where there name is like “%mike%” and have this update my @contacts variable. Maybe I’m approaching this the wrong way but I’m clueless where to start.
Thanks in advance.
Mike,
Here’s a sample app that does what you’re looking for. Check out the Readme.markdown for sample usage.
https://github.com/JumpstartLab/contacts