Sha256: bf1df311b38fe18ee29fa36413d3815e5eec80ab4e283684cbcbd22cfdf42f6a
Contents?: true
Size: 1.91 KB
Versions: 3
Compression:
Stored size: 1.91 KB
Contents
require 'active_support/core_ext/module' require 'schema_comments/version' require 'schema_comments/railtie' module SchemaComments autoload :Base , 'schema_comments/base' autoload :ConnectionAdapters, 'schema_comments/connection_adapters' autoload :Migration , 'schema_comments/migration' autoload :Migrator , 'schema_comments/migrator' autoload :Schema , 'schema_comments/schema' autoload :SchemaComment , 'schema_comments/schema_comment' autoload :SchemaDumper , 'schema_comments/schema_dumper' mattr_accessor :yaml_path mattr_accessor :quiet class YamlError < StandardError end class << self def setup base_names = %w(Base Migration Migrator Schema) + %w(Column ColumnDefinition TableDefinition).map{|name| "ConnectionAdapters::#{name}"} base_names.each do |base_name| ar_class = "ActiveRecord::#{base_name}".constantize sc_class = "SchemaComments::#{base_name}".constantize unless ar_class.ancestors.include?(sc_class) ar_class.__send__(:include, sc_class) end end unless ActiveRecord::ConnectionAdapters::AbstractAdapter.ancestors.include?(SchemaComments::ConnectionAdapters::Adapter) ActiveRecord::ConnectionAdapters::AbstractAdapter.module_eval do include SchemaComments::ConnectionAdapters::Adapter end end # %w(Mysql PostgreSQL SQLite3 SQLite Firebird DB2 Oracle Sybase Openbase Frontbase) %w(Mysql Mysql2 PostgreSQL SQLite3 SQLite).each do |adapter| begin require("active_record/connection_adapters/#{adapter.downcase}_adapter") adapter_class = ('ActiveRecord::ConnectionAdapters::' << "#{adapter}Adapter").constantize adapter_class.module_eval do include SchemaComments::ConnectionAdapters::ConcreteAdapter end rescue Exception => e end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
schema_comments-0.4.0 | lib/schema_comments.rb |
schema_comments-0.3.2 | lib/schema_comments.rb |
schema_comments-0.3.1 | lib/schema_comments.rb |