avo
avo copied to clipboard
feature: `association` option for association fields
Description
Fixes #2559
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
- Step 1
- Step 2
Manual reviewer: please leave a comment with output from the test if that's the case.
Code Climate has analyzed commit 7c7fa1a2 and detected 0 issues on this pull request.
View more on Code Climate.
TODO:
- [x] docs
- [x] PR description
- [x] tests
- [x] fix select all issue where it selects all from both tables
Let's wait on this.
I have an idea of a for_column
or for_field
(open to better naming) which should do the same thins as association
but for any field.
field :full_name, as: :text, for_field: :name, format_using: -> {something}
field :super_name, as: :text, for_field: :name, format_using: -> {something_else}
Do you think we need something like that?
Let's wait on this. I have an idea of a
for_column
orfor_field
(open to better naming) which should do the same thins asassociation
but for any field.field :full_name, as: :text, for_field: :name, format_using: -> {something} field :super_name, as: :text, for_field: :name, format_using: -> {something_else}
Do you think we need something like that?
for_field
option aims to the model attribute? I.E. both fields on your example will fetch the value from record.name
?
If i understand it right I think that's interesting and is like renaming and extending the association
option to all fields :ok_hand:
This opens another suggestion, a way to directly pass the value similar like the field block but applied to all views
field :full_name, as: :text, value: -> { record.name }, format_using: -> {something}
field :super_name, as: :text, value: -> { record.name }, format_using: -> {something_else}
Lets keep an eye on this PR since some logic might be reused whatever approach we follow.
Actually with the value: -> { record.name }
suggestion there is no need to format, is like for_field
+ format_using
in one option
This PR has been marked as stale because there was no activity for the past 15 days.
Let's create a PoC for this and name it for_attribute
or as_attribute
.
This PR has been merged into main
. The functionality will be available in the next release.
Please check the release guide for more information.