rroblak / seed_dump

Rails 4/5 task to dump your data to db/seeds.rb
MIT License
1.39k stars 225 forks source link

Not working with ActionText::RichText #154

Open mhenrixon opened 3 years ago

mhenrixon commented 3 years ago

These are the values generated from db:seed:dump. It seems like the ActionText::Content isn't dumped correctly.

ActionText::RichText.create!([
  {name: "excerpt", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Article", record_id: 1},
  {name: "content", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Article", record_id: 1},
  {name: "excerpt", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Article", record_id: 2},
  {name: "content", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Article", record_id: 2},
  {name: "description", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Announcement", record_id: 1},
  {name: "excerpt", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Article", record_id: 3},
  {name: "content", body: #<ActionText::Content "<!-- BEGIN vendor/bund...">, record_type: "Article", record_id: 3}
])
pkemble commented 3 years ago

Same here. Rails 6.1.1 Ruby 3.0.0p0 seed_sump 3.3.1

ActionText::RichText.create!([ {name: "content", body: #<ActionText::Content "<div class=\"trix-conte...">, record_type: "Post", record_id: 377}, {name: "content", body: #<ActionText::Content "<div class=\"trix-conte...">, record_type: "Post", record_id: 254}, {name: "content", body: #<ActionText::Content "<div class=\"trix-conte...">, record_type: "Post", record_id: 255}, {name: "content", body: #<ActionText::Content "<div class=\"trix-conte...">, record_type: "Post", record_id: 256}, {name: "content", body: #<ActionText::Content "<div class=\"trix-conte...">, record_type: "Post", record_id: 257}, ...

Spone commented 3 years ago

You can try this branch: https://github.com/Spone/seed_dump/tree/actiontext-support

brunnopleffken commented 4 months ago

It's not working with ActionText. Even if I pass the models with the data I want to export, for example:

rails db:seed:dump models=Category,City,State --trace

None of these models have has_rich_text. It returns the error:

** Invoke db:seed:dump (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:seed:dump
bin/rails aborted!
ActiveRecord::Encryption::Errors::Configuration: Missing Active Record encryption credential: active_record_encryption.primary_key (ActiveRecord::Encryption::Errors::Configuration)

And by the way, my encryption credentials are OK. My seeds.rb file gets stuck like this:

Screenshot 2024-07-01 at 19 15 14