avo
avo copied to clipboard
[Raills 8] Reflections have a symbol as key.
._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
-
rails new demo --main
-
cd demo
-
bin/rails app:template LOCATION='https://avohq.io/app-template'
-
bin/rails g model Category name
-
bin/rails g model Book name category:references
- add category field to the book resource with
belongs_to
- 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.