RailsCasts Pro episodes are now free!

Learn more or hide this

kainlite's Profile

GitHub User: kainlite

Comments by

Avatar

Ryan, I've been watching a lot of railscasts, I'm lacking of knowledge in the subject, but there is a "Right way TM." to do a proper union in a "complex sql query" using ActiveRecord or Arel? I will show you what I'm trying to generate :(

sql
SELECT * FROM users WHERE id = (SELECT enrollable_id FROM enrollments WHERE enrollable_type='User')
UNION ALL
SELECT * FROM users WHERE id = (SELECT user_id FROM memberships WHERE group_id = (SELECT enrollable_id FROM enrollments WHERE enrollable_type='Group'))

Is awesome what you can get with Arel but I don't know if what I'm trying to do is breaking any rule or is just not possible using AR or Arel..

Avatar

awesomeness on every railscast!

Avatar

Great episode thank you Ryan, keep the good work ;-)

Avatar

Awesome, you're great, I love your screencasts :)