title: ROR: connecting two databases and moving data from one table to another table
body: <p>I have two applications called app1 &amp; app2, I have connected two database using connection establish method. I have same table name in both the databases, now I want to send selected data from app2 to app1. Here is my code for connecting two databases, please help me on this. </p>
  
  <pre><code>   class Student &lt; ActiveRecord::Base
  
     establish_connection :adapter  =&gt; "mysql2",
  
                     :database =&gt; "app1_db",
  
                     :username =&gt; "root",
  
                     :password =&gt; "root"
  
       set_table_name "students" 
  
       belongs_to :student, :class_name =&gt; "students", :foreign_key =&gt; "fk_student_id"
  
       end
  </code></pre>