execute sql query in rails code example
Example 1: rails execute sql
results = ActiveRecord::Base.connection.exec_query(sql)
Example 2: Ruby on rails execute query
ActiveRecord::Base.connection.execute("SQL query")
results = ActiveRecord::Base.connection.exec_query(sql)
ActiveRecord::Base.connection.execute("SQL query")