How do I merge these two ActiveRecord Relations?
activity1 = PublicActivity::Activity.where("user_recipients LIKE ':id,%' or user_recipients LIKE '%, :id' or user_recipients LIKE '%, :id,%' or user_recipients = ':id'", id: current_user.id)
activity2 = PublicActivity::Activity.where(recipient_id: current_user.id, recipient_type: 'User')
When I do this, if one is empty they default to the empty one
@activity = activity1.merge(activity2)
It's simple why the merge is return empty array it's because it use AND
between the queries try this:
@activity = (activity1 + activity2)