forked from elithecho/fusrodah
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.rb
More file actions
28 lines (22 loc) · 731 Bytes
/
Copy pathmodels.rb
File metadata and controls
28 lines (22 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require_relative "db"
require "sequel/model"
if ENV['RACK_ENV'] == 'development'
Sequel::Model.cache_associations = false
end
Sequel::Model.plugin :auto_validations
Sequel::Model.plugin :prepared_statements
Sequel::Model.plugin :subclasses unless ENV['RACK_ENV'] == "development"
# Sequel::Model.plugin :dirty
# Sequel::Model.db.extension(:pagination)
# Sequel::Model.raise_on_save_failure = false
Dir["./models/**/*.rb"].each { |f| require f }
if %w[development test].include?(ENV["RACK_ENV"])
require "logger"
LOGGER = Logger.new($stdout)
LOGGER.level = Logger::FATAL if ENV["RACK_ENV"] == "test"
DB.loggers << LOGGER
end
unless ENV["RACK_ENV"] == "development"
Sequel::Model.freeze_descendents
DB.freeze
end