I\'m trying to create a table in my view and populate it on some conditions.
I have two tables, Both have two columns inside, One columns called event_url
You can easily achieve the result by using a LEFT OUTER JOIN from Table A to Table B, as described in this visual explanation.
Specifically, what you want is:
To produce the set of records only in Table A, but not in Table B, we perform the same left outer join, then exclude the records we don't want from the right side via a where clause.
In your question is not clear how the tables are called, and how they relate each other. However, to achieve the result simply perform a join between the tables using the ActiveRecord join
method
TableA.joins('LEFT OUTER JOIN TableB on TableA.field = TableB.field')
and select only the items where(TableB.id IS NULL
).
You'll have to adapt the example to your needs.