Created
January 25, 2014 02:55
-
-
Save georgebashi/8611111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem 'activerecord' | |
gem 'ar-octopus', require: 'octopus' | |
gem 'sqlite3' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "octopus" | |
class User < ActiveRecord::Base | |
has_many :works | |
end | |
class Work < ActiveRecord::Base | |
end | |
ActiveRecord::Base.establish_connection YAML.load_file("config/database.yml")["development"] | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.connection.execute("create table if not exists user (id int); create table if not exists works (id int); create table if not exists user_works (user_id int, work_id int);") | |
a = User.using(:read_slave).first | |
a.works | |
b = User.last | |
b.save |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment