lib/schema_monkey/client.rb in schema_monkey-2.0.0 vs lib/schema_monkey/client.rb in schema_monkey-2.0.1
- old
+ new
@@ -14,11 +14,10 @@
private
def insert_active_record(dbm: nil)
# Kernel.warn "--- inserting active_record for #{@root}, dbm=#{dbm.inspect}"
find_modules(:ActiveRecord, dbm: dbm).each do |mod|
- next if mod.is_a? Class
relative_path = canonicalize_path(mod, :ActiveRecord, dbm)
ActiveRecord.insert(relative_path, mod)
end
end
@@ -33,10 +32,10 @@
def canonicalize_path(mod, base, dbm)
path = mod.to_s.sub(/^#{@root}::#{base}::/, '')
if dbm
path = path.split('::')
- if (i = path.find_index(&it =~ /\b#{dbm}\b/i)) # delete first occurence
+ if (i = path.find_index(&it =~ /\b#{dbm}\b/i)) # delete first occurence
path.delete_at i
end
path = path.join('::').gsub(/#{dbm}/i, dbm.to_s) # canonicalize case for things like PostgreSQLAdapter
end
path