Skip to content

Instantly share code, notes, and snippets.

@yanmhlv
Created October 26, 2016 16:06
Show Gist options
  • Save yanmhlv/7b8f60b9d7531b5a79d2eb75cb031b44 to your computer and use it in GitHub Desktop.
Save yanmhlv/7b8f60b9d7531b5a79d2eb75cb031b44 to your computer and use it in GitHub Desktop.
require 'active_record'
ActiveRecord::Base.establish_connection({
adapter: 'postgres', # or mysql2
host: 'localhost',
username: 'username',
password: 'password',
database: 'dbname',
})
# ActiveRecord::Base.establish_connection("postgres://username:password@host/dbname")
class User < ActiveRecord::Base
self.table_name = "my_users"
self.primary_key = "id"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment