scope1 = Model.relations1.where(:color => 'blue')
scope2 = Model.relations2.where(:color => 'red')
combine_ids = (scope1 + scope2).uniq
result = Model.where(id: combine_ids)
Created
September 23, 2014 09:22
-
-
Save francois-blanchard/83a24fa97fe2065eef0a to your computer and use it in GitHub Desktop.
Combine two ActiveRecord objects
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment