avo icon indicating copy to clipboard operation
avo copied to clipboard

[Raills 8] Reflections have a symbol as key.

Open peterberkenbosch opened this issue 9 months ago • 7 comments

._reflections returns a Hash with symbols as keys since https://github.com/rails/rails/commit/d9a54e41ab147a7e98559ffddda8ffc0fc059daa, and using the to_s is causing the belongs_to field to error with

undefined method `klass' for nil

when trying to create a new record.

Description

Fixes # (issue)

Checklist:

  • [ ] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have added tests that prove my fix is effective or that my feature works

Screenshots & recording

Manual review steps

  1. rails new demo --main
  2. cd demo
  3. bin/rails app:template LOCATION='https://avohq.io/app-template'
  4. bin/rails g model Category name
  5. bin/rails g model Book name category:references
  6. add category field to the book resource with belongs_to
  7. try adding a new book. This will error without this change.

Manual reviewer: please leave a comment with output from the test if that's the case.

peterberkenbosch avatar May 22 '24 08:05 peterberkenbosch