Sha256: 658454a64eb4d31f28872c55bbc2eeba3a6ddd500c4f8855426d117bffb25d17

Contents?: true

Size: 683 Bytes

Versions: 2

Compression:

Stored size: 683 Bytes

Contents

require 'yaml'
require 'active_record'
require 'fresh_connection'

system("mysql -uroot < spec/db_schema.sql")

module ActiveRecord
  class Base
    self.configurations = YAML.load_file(File.join(File.dirname(__FILE__), "database.yml"))
    establish_connection(configurations["test"])
    establish_fresh_connection :slave1
  end
end

class Parent < ActiveRecord::Base
  self.abstract_class = true
end

class Slave2 < ActiveRecord::Base
  self.abstract_class = true
  establish_fresh_connection :slave2
end

class User < ActiveRecord::Base
  has_one :address
  has_many :tels
end

class Address < ActiveRecord::Base
  belongs_to :user
end

class Tel < Slave2
  belongs_to :user
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fresh_connection-0.4.0 spec/prepare.rb
fresh_connection-0.3.0 spec/prepare.rb