Retrieving Link Metadata with Background Jobs Discussion
Posting here in case anyone else ran into the issue where they tried to run a test, but got the error of having pending database migrations (also after running db:migrate).
For me what helped is running db:migrate for the test environment, so:
bin/rails db:migrate RAILS_ENV=test
After that, tests would run fine.
I'm running Rails 8 and the respond_to
links controller portion of the code is not needed for the immediate update on the frontend from the metadata job—link.broadcast_replace_to(link)
works without any additional configuration. Does this have something to do with Hotwire or something specific in Rails 8?
Additionally, the clearing of the form field is also automatically cleared once a link is save. Is this also a newly baked in feature of Hotwire?
Great tip for resolving pending database migrations! Running db:migrate for the test environment is often overlooked. For those interested in exploring a fun escape from coding errors, check out Pokerogue and Pokerogue Dex game. It’s a fantastic way to relax and even provides some strategic thinking that could apply to debugging too!