-
-
Notifications
You must be signed in to change notification settings - Fork 212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
record_link format_using doesn't work #2747
Comments
My goal is to provide the link to My understanding is |
That is partially correct. What it could use is a field option where you can specify which property to use, somewhere around here. # maybe something like this?
field :item, as: :record_link, record_property: :item_id Would you be able to try to do that in a PR? |
From my understanding of field :item, as: :record_link, add_via_params: false, name: 'Item', only_on: %i[index show],
format_using: -> { record.item_id || 'or whatever I want here' } do
record.item # this is default of course because field first argument is already `:item`, but I can use any logic here
end Returned value from |
I took a look at the code and seems like it happens because in the context of the RecordLink field the This made me realize that field :car_class, as: :belongs_to, format_using: -> { 'test' }
|
That's correct. It won't work for belongs_to either. Think about it like this:
So, for the |
This issue has been marked as stale because there was no activity for the past 15 days. |
Describe the bug
This works:
This doesn't:
Whatever I use under
format_using
, even if just a string –format_using: -> { 'test' }
– an exception happens:Steps to Reproduce
N/A
Expected behavior & Actual behavior
Record link is generated but instead of using record title it uses
format_using
output.Models and resource files
N/A
System configuration
Avo version: 3.7.0
Rails version: 7.1.3.2
Ruby version: 3.1.5
License type:
Are you using Avo monkey patches, overriding views or view components?
Screenshots or screen recordings
N/A
Additional context
N/A
Impact
Urgency
The text was updated successfully, but these errors were encountered: