I have a table called translations. (And a correspoding ActiveRecord class). This table contains the following fields id, key and value
I would like to select all translations where the key matches a given query + all the translations that don't match the query, but share the key with a translation which does matches the query.
The resulting SQL could look something like this:
SELECT * FROM TRANSLATIONS where key in (select key from Translations where value like '%some search%')
I've tried a few things, but I can't seem to figure it out. Any ideas on how to express this in Arel?