Code Monkey home page Code Monkey logo

Comments (8)

jacobat avatar jacobat commented on June 3, 2024 2

I added a monkey patch in an initializer:

if defined?(DatabaseCleaner)
  module DatabaseCleaner
    module ActiveRecord
      class Base
        private

        def load_config
          if db != :default && db.is_a?(Symbol) && File.file?(DatabaseCleaner::ActiveRecord.config_file_location)
            connection_details = YAML::load(ERB.new(IO.read(DatabaseCleaner::ActiveRecord.config_file_location)).result, aliases: true)
            @connection_hash   = valid_config(connection_details, db.to_s)
          end
        end
      end
    end
  end
end

from database_cleaner.

etagwerker avatar etagwerker commented on June 3, 2024 1

@jacobat Thanks for submitting this issue! Would you be interested in submitting a PR so that people no longer have to use that monkey patch?

from database_cleaner.

cesarjr avatar cesarjr commented on June 3, 2024

Same problem over here. It "works" if I remove database cleaner.

@jacobat, did you find some solution? The only way I found was to remove alias at database.yml and duplicate all the config.

from database_cleaner.

cesarjr avatar cesarjr commented on June 3, 2024

Thanks, man! 🤜🤛

from database_cleaner.

jvortmann avatar jvortmann commented on June 3, 2024

@etagwerker I believe this is fixed on active_record adapter on https://github.com/DatabaseCleaner/database_cleaner-active_record/blob/v2.1.0/lib/database_cleaner/active_record/base.rb#L57 but we need a new version of database-cleaner released with a loosen restriction on https://github.com/DatabaseCleaner/database_cleaner/blob/main/database_cleaner.gemspec#L19 otherwise we can't update the active-record adapter with the fix with an bundle update database_cleaner-active_record.

This is the fix: DatabaseCleaner/database_cleaner-active_record@b750ac7

I suggest using just ~> 2 there to easy future updates to get minor and patch fixes.

from database_cleaner.

etagwerker avatar etagwerker commented on June 3, 2024

@jvortmann Sounds like a good idea. Thank you!

from database_cleaner.

jacobat avatar jacobat commented on June 3, 2024

Thank you!

from database_cleaner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.