Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # whenever you need to do a custom query/function/sproc into another DB that is not development
- app = ActiveRecord::Base.establish_connection(
- adapter: "mysql",
- host: "localhost",
- username: "myuser",
- password: "mypass",
- database: "somedatabase"
- )
- # if you have already defined an entry in database.yml
- # -------------- READ THIS TOO ---------------------------------
- # use app = ActiveRecord::Base.establish_connection(:your_custom_db)
- sql = <<-SQL
- select * FROM whatever_table( 'somestring', 2016 );
- SQL
- app.connection.execute(sql)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement