This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "sequel" | |
DB = Sequel.sqlite | |
DB.create_table :albums do | |
primary_key :id | |
column :title, :text | |
end | |
DB.create_table :artists do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/sequel/plugins/class_table_inheritance.rb b/lib/sequel/plugins/class_table_inheritance.rb | |
index 6c8af1697..c48a2a779 100644 | |
--- a/lib/sequel/plugins/class_table_inheritance.rb | |
+++ b/lib/sequel/plugins/class_table_inheritance.rb | |
@@ -283,7 +283,7 @@ module Sequel | |
if table = cti_table_map[n.to_sym] | |
columns = db.schema(table).map(&:first) | |
else | |
- table = if cti_qualify_tables && (schema = dataset.schema_and_table(table_name).first) | |
+ table = if cti_qualify_tables && (schema = dataset.schema_and_table(cti_table_name).first) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/sequel/plugins/class_table_inheritance.rb b/lib/sequel/plugins/class_table_inheritance.rb | |
index 214f50bb7..40c65d784 100644 | |
--- a/lib/sequel/plugins/class_table_inheritance.rb | |
+++ b/lib/sequel/plugins/class_table_inheritance.rb | |
@@ -198,6 +198,9 @@ module Sequel | |
# Overrides implicit table names. | |
# :ignore_subclass_columns :: Array with column names as symbols that are ignored | |
# on all sub-classes. | |
+ # :qualify_tables :: Boolean true to qualify automatically determined | |
+ # subclass tables with the same qualifier as their |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "logger" | |
require "sequel" | |
DB = Sequel.connect ENV["DATABASE_URL"], test: true, encoding: "utf-8" | |
# DB.logger = Logger.new($stdout) | |
require "sequel/plugins/class_table_inheritance" | |
module Sequel | |
module Plugins | |
module ClassTableInheritance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "logger" | |
require "sequel" | |
DB = Sequel.connect ENV["DATABASE_URL"], test: true, encoding: "utf-8" | |
DB.logger = Logger.new($stdout) | |
Sequel.extension :migration | |
Sequel.migration do | |
up do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
require "capybara/dsl" | |
require "selenium-webdriver" | |
Capybara.javascript_driver = :selenium_chrome_headless | |
Capybara.default_driver = Capybara.javascript_driver | |
Capybara.app = lambda do |env| | |
req = Rack::Request.new(env) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "minitest/autorun" | |
require "capybara/poltergeist" | |
# Capybara.register_driver :poltergeist do |app| | |
# Capybara::Poltergeist::Driver.new(nil, { debug: true }) | |
# end | |
Capybara.javascript_driver = :poltergeist | |
Capybara.default_driver = Capybara.javascript_driver | |
Capybara.app = lambda do |env| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test::Unit::TestCase | |
def self.setup(&block) | |
setup_blocks << block | |
end | |
def setup | |
self.class.setup_blocks.each do |block| | |
instance_eval(&block) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'global_settings' | |
Settings = GlobalSettings.new(File.join(Rails.root, 'config', 'settings.yml')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'yaml' | |
class GlobalSettings < Hash | |
# TODO: take namespace as a param and get rid of rails dependency | |
def initialize(path) | |
raise "No settings yml file found (#{path})" unless File.exists?(path) | |
settings = (YAML.load_file(path) || {})[Rails.env] || {} | |
Rails.logger.info "WARNING: No settings loaded for environment #{Rails.env}" if settings.empty? | |
update settings.symbolize_keys | |
freeze |
NewerOlder