How to use Ruby on Rails to do this?
mysql> SET @t1=1, @t2=2, @t3:=4;
mysql> SELECT @t1, @t2, @t3, @t4 := @t1+@t2+@t3;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use
ActiveRecord::Base.connection:For more methods you can use on this class, see the documentation here.
You can also call the
connectionmethod on any ActiveRecord class you have defined. For instance, if you have a model calledPost, you can usePost.connection.execute("sql").