I need the controller to check if a string exists in a table and then return "true" or "false" so that I can use it in an if statement. For example, if the string "Robert" exists in the "my_friends" table, I need to display those corresponding items related to "Robert" from another table called "goodtimes."
I realize the .exists won't work in this application because I'm searching for a string.
@my_friends.where(friend_id: 'Robert').exists? #always returns false
@goodtimes = goodtime.where friend_id: "Robert" #works
The pseudo code would look like this:
if (table x contains string "Robert")
@goodtimes = goodtime.where friend_id: "Robert" #display goodtimes from table y
Thanks in advance, Dave