Does this Gem work with Rails 6?
MattGaud2425 opened this issue ยท 10 comments
Can't get seed dump to edit the seeds.rb file.
looks wonky. the rake task does nothing, without explanation, and using it from the console seems to be working, but leads to a rails deprecation warning, stating that this will not work from rails 6.1 onwards.
thanks for the info. ill try it with rails console
Doesn't work with Rails 6 on my side. I loved using this gem in Rails 5.
You can enter rails console and just dump into seeds file in rails 6. so partially works i found.
SeedDump.dump
worked fine for me on a non-simple table with options
rake db:seed:dump
ran - gave me two seemingly random tables (out of ~25) and exited without errors or warnings.
This is on 6.0.0.rc2
edit: did some digging: Looks like an issue with the changes to the auto loading with rails 6 - the issue is that in environment.rb:67 ActiveRecord::Base.descendants
always returns an empty array.
if you modify your apps application.rb
and add config.autoloader = :classic
right after the rails 6 defaults seed_dump should work.
looks like a call to Zeitwerk::Loader.eager_load_all
needs to be added to the top of environment.rb
by the other eager load at the top with some version checking to fix up support for rails 6 - I'll pull together a PR tomorrow for it.
@tongboy would this fix the deprecation warning, beginning with rails 6.1, that i mentioned? i'm afraid i can't remember what the issue was exactly.
@tongboy would this fix the deprecation warning, beginning with rails 6.1, that i mentioned? i'm afraid i can't remember what the issue was exactly.
I don't recall seeing any depr warnings... I'll take a look at it again. I think I'm actually going to file this as a bug with rails first as this is a regression with the behavior of the eager_load with the new Zeitwerk eagerloader.
Submitted rails bug: rails/rails#37006 I'll see where that goes - if it doesn't move along quickly I'll pull together a PR to get this working with rails 6 as it stands
@cvshepherd can you double check if you're still seeing any depr warnings? I ran through everything on a fresh rails 6.0.0 instance and aside from some rspec/testing deprecations I didn't get any warnings or notes during application execution
I can't believe no one has come out with a replacement for 6.
I've been using it with Rails 6 with no issues or deprecation warnings. My only 'issue' with it is it still uses the create! in the seeds.rb file vs the new insert_all! method.