with_model
with_model copied to clipboard
Dynamically build an Active Record model (with table) within a test context
Hello, Regarding the following part of the code: https://github.com/Casecommons/with_model/blob/481e96bfb4b84f5ba92e0206a6280ed3f5a6d257/lib/with_model/model.rb#L59 This call has a side effect on our project: all the models that inherit `ActiveRecord::Base` are not available in the `ActiveRecord::Base.descendants`...
We're getting an error when we have `cache_classes = true` on CI with Rails 7.0.1: ``` RuntimeError: DescendantsTracker.clear was disabled because config.cache_classes = true # /home/circleci/app/vendor/bundle/ruby/2.7.0/gems/activesupport-7.0.1/lib/active_support/descendants_tracker.rb:119:in `clear' # /home/circleci/app/vendor/bundle/ruby/2.7.0/gems/with_model-2.1.6/lib/with_model/model.rb:59:in `cleanup_descendants_tracking'...
Updates the requirements on [sqlite3](https://github.com/sparklemotion/sqlite3-ruby) to permit the latest version. Release notes Sourced from sqlite3's releases. 1.7.3 / 2024-03-15 Dependencies Vendored sqlite is updated to v3.45.2. @flavorjones sha256 checksums: 0ccb8c001cd2617f4801a2c816142d3c9bc299e3f3e0f49e03812f3610b0891c...
Before this change, using `with_model` with a superclass that connects to a database other than the database configured for `ActiveRecord::Base` would end up creating the table in the wrong database.
I made you a lil repro script. The child without foreign key is created just fine, the child with foreign key hits an exception. ```ruby require "bundler/inline" gemfile do source...
**The error:** `ActiveRecord::RecordNotUnique: Mysql2::Error: Duplicate entry 'FakeRecord-1' for key 'index_entities_on_entityable'` ------ I have a table with a polymorphic unique relationship: ```ruby create_table :entities do |t| t.references :entityable, null: false, polymorphic:...