Merge branch 'master'

Conflicts:
	Pearlception/db/schema.rb
This commit is contained in:
Okechi Onyeje 2017-01-09 13:50:25 -05:00
commit 4ee7e125b0
5 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,6 @@
class Oyster < ApplicationRecord
belongs_to :run
Oyster.establish_connection(:"stats_#{Rails.env}")
end

View File

@ -0,0 +1,4 @@
class Run < ApplicationRecord
has_many :oysters
establish_connection(:"stats_#{Rails.env}")
end

View File

@ -14,9 +14,23 @@ default: &default
encoding: utf8
pool: 5
username: root
password:
password: terps
socket: /var/run/mysqld/mysqld.sock
stats_development: &stats
adapter: mysql2
encoding: utf8
pool: 5
username: <%= ENV['STATS_DB_USER'] %>
password: <%= ENV['STATS_DB_PASS'] %>
host: <%= ENV['STATS_DB_URL'] %>
port: 3306
database: main
stats_test:
<<: *stats
development:
<<: *default
database: Pearlception_development

View File

@ -10,6 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
<<<<<<< HEAD
ActiveRecord::Schema.define(version: 20170109174008) do
create_table "companies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
@ -36,5 +37,8 @@ ActiveRecord::Schema.define(version: 20170109174008) do
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end
=======
ActiveRecord::Schema.define(version: 0) do
>>>>>>> master
end

View File

@ -0,0 +1,18 @@
require 'test_helper'
class OysterTest < ActiveSupport::TestCase
test "check_connection" do
Oyster.connection
assert true
end
test "get_first_oyster" do
first = Oyster.first
id = first.oyster_id == 1
run = first.run_id == 257
grade = first.grade == "Rej"
assert id && run && grade
end
end