Created
October 27, 2014 12:59
-
-
Save solnic/0b93dbfb2410fd855fbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# without unique column names this is what you need to do to make sure the result set has correct values and there | |
# are no name clashes | |
DB[:users]. | |
join_table(:inner, :tasks, user_id: :users__id). | |
select(:tasks__id___task_id, :users__id___users_id) | |
# versus this, if we had unique column names by default | |
DB[:users].natural_join(:tasks).select(:task_id, :user_id) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is this Sequel?