Du kan använda cmd_tuples
metod:
sql = "UPDATE users SET updated_at = '#{DateTime.now}' WHERE id = 1"
ActiveRecord::Base.connection.execute(sql).cmd_tuples
# => 1
Dokumentation:http://www.rubydoc.info/gems /pg/0.17.1/PG%2FResult:cmd_tuples
Du kan använda cmd_tuples
metod:
sql = "UPDATE users SET updated_at = '#{DateTime.now}' WHERE id = 1"
ActiveRecord::Base.connection.execute(sql).cmd_tuples
# => 1
Dokumentation:http://www.rubydoc.info/gems /pg/0.17.1/PG%2FResult:cmd_tuples