mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 03:37:40 +00:00
Merge branch 'master'
Conflicts: Pearlception/db/schema.rb
This commit is contained in:
commit
4ee7e125b0
6
Pearlception/app/models/oyster.rb
Normal file
6
Pearlception/app/models/oyster.rb
Normal file
@ -0,0 +1,6 @@
|
||||
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
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
18
Pearlception/test/models/oyster_test.rb
Normal file
18
Pearlception/test/models/oyster_test.rb
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user