Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class External < ActiveRecord::Base
- self.abstract_class = true
- # Setup connection for an account through a Norad resource
- def self.use_account(account_id)
- return true unless ['staging', 'production'].include?(RAILS_ENV)
- return false unless resource = Resource.find(:first,
- :conditions => ['account_id = ?', account_id])
- self.establish_connection(
- :adapter => "mysql",
- :host => resource.hostname,
- :username => resource.username,
- :password => resource.password,
- :database => resource.database
- )
- end
- end
Add Comment
Please, Sign In to add comment