Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Direct connection to secondary database not working
- class SupportBase < ActiveRecord::Base
- configurations = { :adapter => 'mysql',
- :encoding => 'utf8',
- :reconnect => 'true',
- :database => 'xxxxxx',
- :username => 'xxxxxx',
- :password => 'xxxxxx',
- :host => 'xxxxxx',
- :port => 'xxxxx'
- }
- self.abstract_class = true #important!
- establish_connection configurations["deals_qa"]
- set_table_name = 'members'
- def self.get_test_name(id)
- if id == 0
- return ''
- else
- if SupportBase.connected?
- conn = SupportBase::connection
- query = "SELECT * FROM members where id = '#{id}'"
- #tst = connection.select_all(query)
- tst = conn.select_values(query)
- return tst[0].fetch('id')
- else
- return ''
- end
- end
- end
- end
Add Comment
Please, Sign In to add comment