mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 11:47:41 +00:00
Connect remote dbs
This commit is contained in:
parent
6b68be2b17
commit
92b58aa680
@ -1,4 +1,6 @@
|
||||
class Oyster < ActiveRecord::Base
|
||||
establish_connection("stats")
|
||||
class Oyster < ApplicationRecord
|
||||
belongs_to :run
|
||||
Oyster.establish_connection(:"stats_#{Rails.env}")
|
||||
|
||||
|
||||
end
|
||||
|
||||
4
Pearlception/app/models/run.rb
Normal file
4
Pearlception/app/models/run.rb
Normal file
@ -0,0 +1,4 @@
|
||||
class Run < ApplicationRecord
|
||||
has_many :oysters
|
||||
establish_connection(:"stats_#{Rails.env}")
|
||||
end
|
||||
@ -17,15 +17,19 @@ default: &default
|
||||
password: terps
|
||||
socket: /var/run/mysqld/mysqld.sock
|
||||
|
||||
stats:
|
||||
stats_development: &stats
|
||||
adapter: mysql2
|
||||
encoding: utf8
|
||||
pool: 5
|
||||
username: <%= ENV['DB_USER'] %>
|
||||
username: ivauser
|
||||
password: <%= ENV['DB_PASS'] %>
|
||||
host: taylors.c02zesysnssi.us-west-2.rds.amazonaws.com
|
||||
port: 3306
|
||||
database: taylors
|
||||
database: main
|
||||
|
||||
|
||||
stats_test:
|
||||
<<: *stats
|
||||
|
||||
development:
|
||||
<<: *default
|
||||
|
||||
9
Pearlception/test/models/oyster_test.rb
Normal file
9
Pearlception/test/models/oyster_test.rb
Normal file
@ -0,0 +1,9 @@
|
||||
require 'test_helper'
|
||||
|
||||
class OysterTest < ActiveSupport::TestCase
|
||||
test "the_truth" do
|
||||
f = Oyster.first
|
||||
puts f.inspect
|
||||
assert true
|
||||
end
|
||||
end
|
||||
Loading…
x
Reference in New Issue
Block a user