Okechi Onyeje f06c2ca057 Mutltiple database pattern for companies integrated
- When creating a new company as an admin, a new database containing models for Runs, Grades, Results, Machines, and Oysters is migrated and created
- When a user registers, they are automatically switched to their company's db in the server
- When a user signs in they are also automatically swithched
2017-02-16 12:34:29 -05:00

13 lines
388 B
Ruby

class Oyster < ApplicationRecord
belongs_to :run
#Oyster.establish_connection(:"stats_#{Rails.env}")
#Oyster.establish_connection(
#:adapter => "mysql2",
#:host => ENV['STATS_DB_URL'],
#:username => ENV['STATS_DB_USER'],
#:password => ENV['STATS_DB_PASS'],
#:database => "main"
#)
scope :run_id, -> (id) { where run_id: id.to_i }
end