Since Rails 7 you can not scaffold tables in the index view any more. Instead you have a list of cards. Here's how you can bring back tables to your scaffolds.
DHH hates this one simple trick!
Episode source code: https://github.com/corsego/164-scaffold-erb-tables/commit/bbcd2d880824dfb838564b86024a8dd902028cf1
Based on this blogpost: https://blog.corsego.com/custom-scaffold-templates
Resources:
- https://www.reddit.com/r/rails/comments/1bb0ixo/why_did_rails_7_kill_scaffolding/
- https://www.reddit.com/r/rails/comments/pztx9g/scaffold_index_no_longer_generating_html_tables/
- https://discuss.rubyonrails.org/t/back-again-after-a-long-time-rails-7-scaffolds-table-view/80967
- https://stackoverflow.com/questions/71357307/no-table-view-after-crud-scaffolding
- https://github.com/rails/rails/pull/41210
- https://github.com/rails/rails/blob/ecb2850a04adc6c6665f9a30a1d60ca73965ccfa/railties/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt
1