Created
April 9, 2023 14:03
-
-
Save salvadorgascon/d1cb9d1bb7d7c780df15ab622c610a82 to your computer and use it in GitHub Desktop.
Run a sql statement with parameters for PostgreSQL in Ruby on Rails
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
statement = | |
<<-SQL | |
UPDATE customers set search_text = CONCAT(code,' ',name) where id = $1 | |
SQL | |
ActiveRecord::Base.connection.raw_connection.exec_params(statement, [id]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment