Last active
June 8, 2018 20:52
-
-
Save wykhuh/58f33a07ccdefaf23dbc5c553a521989 to your computer and use it in GitHub Desktop.
Ruby: splat array with string interpolation
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
# https://bugs.ruby-lang.org/issues/10930 | |
ids = [1, 2, 3] | |
sql = "SELECT * FROM table WHERE id IN (#{ids.to_s[1..-2]})" | |
ActiveRecord::Base.connection.execute(sql) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment