Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chronomodel breaks compatibility with the upcoming FactoryBot Rails 6.3.0 #231

Closed
tagliala opened this issue Sep 23, 2023 · 1 comment · Fixed by #232
Closed

Chronomodel breaks compatibility with the upcoming FactoryBot Rails 6.3.0 #231

tagliala opened this issue Sep 23, 2023 · 1 comment · Fixed by #232
Labels

Comments

@tagliala
Copy link
Member

tagliala commented Sep 23, 2023

Bisected to: thoughtbot/factory_bot_rails#419

NoMethodError: undefined method `config' for nil:NilClass
~/.rvm/gems/ruby-3.2.2/gems/railties-7.0.8/lib/rails.rb:47:in `configuration'
~/gems/ruby-3.2.2/bundler/gems/factory_bot_rails-659d74ae636c/lib/factory_bot_rails/railtie.rb:25:in `block in <class:Railtie>'

Live demo: https://github.com/diowa/ruby3-rails7-bootstrap-heroku/tree/experimental/chrono-factory-bot-main

Proably chronomodel is hooking into Railties in a wrong way, since the default postgres adapter works

@tagliala tagliala added the bug label Sep 23, 2023
@tagliala tagliala changed the title Chronomodel breaks compatibility with FactoryBot Rails 6.3.0 Chronomodel breaks compatibility with the upcoming FactoryBot Rails 6.3.0 Sep 23, 2023
@tagliala
Copy link
Member Author

ActiveRecord::Base.instance_eval do
# Checks whether this Active Recoed model is backed by a temporal table
#
def chrono?
return false unless connection.respond_to? :is_chrono?
connection.is_chrono?(table_name)
end
end

tagliala added a commit that referenced this issue Sep 24, 2023
tagliala added a commit that referenced this issue Sep 24, 2023
tagliala added a commit that referenced this issue Sep 24, 2023
tagliala added a commit that referenced this issue Oct 8, 2023
tagliala added a commit that referenced this issue Oct 8, 2023
tagliala added a commit that referenced this issue Oct 8, 2023
tagliala added a commit that referenced this issue Oct 8, 2023
tagliala added a commit that referenced this issue Oct 8, 2023
tagliala added a commit that referenced this issue Oct 8, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Oct 16, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Oct 19, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Oct 19, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Oct 19, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Oct 19, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Oct 20, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Nov 1, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426


Close #231
tagliala added a commit that referenced this issue Nov 4, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Ref: thoughtbot/factory_bot_rails#426

Close #231
tagliala added a commit that referenced this issue Nov 4, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Also:
- Require Railtie as suggested by APIs
- Patch DBConsole only if needed
- Move application configuration check in an after initialize lazy load hook
  to be sure that `Rails.application` is available at the moment of the check

Ref:
- thoughtbot/factory_bot_rails#426
- https://edgeapi.rubyonrails.org/classes/Rails/Railtie.html#class-Rails::Railtie-label-Creating+a+Railtie

Close #231
tagliala added a commit that referenced this issue Nov 4, 2023
Extend `ActiveRecord::Base` functionality only after `ActiveRecord` has
been fully loaded.

Also:
- Require Railtie as suggested by APIs
- Patch DBConsole only if needed
- Move application configuration check in an after initialize lazy load hook
  to be sure that `Rails.application` is available at the moment of the check

Ref:
- thoughtbot/factory_bot_rails#426
- https://edgeapi.rubyonrails.org/classes/Rails/Railtie.html#class-Rails::Railtie-label-Creating+a+Railtie

Close #231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant