avo icon indicating copy to clipboard operation
avo copied to clipboard

`link_to_record` should override link to association or throw warning

Open krystof-k opened this issue 1 year ago • 4 comments

Describe the bug

Given

class Avo::Resources::Example < Avo::BaseResource
  def fields
    field :type,
      as: :belongs_to,
      link_to_record: true
  end
end

still links to the Type association, not to the Example record.

Steps to Reproduce

  1. Add link_to_record: true to a belongs_to type
  2. Try to click the link
  3. You end up on the association, not the record

Expected behavior & Actual behavior

It should either override the link to association or throw a warning.

System configuration

Avo version: 3.6.1

Rails version: 7.0.8.1

Ruby version: 3.2.3

License type:

  • [x] Community
  • [ ] Pro
  • [ ] Advanced

Are you using Avo monkey patches, overriding views or view components?

  • [ ] Yes. If so, please post code samples.
  • [x] No

Impact

  • [ ] High impact (It makes my app un-usable.)
  • [ ] Medium impact (I'm annoyed, but I'll live.)
  • [x] Low impact (It's really a tiny thing that I could live with.)

Urgency

  • [ ] High urgency (I can't continue development without it.)
  • [ ] Medium urgency (I found a workaround, but I'd love to have it fixed.)
  • [x] Low urgency (It can wait. I just wanted you to know about it.)

krystof-k avatar Apr 15 '24 13:04 krystof-k

Yeah, we wrote in the docs that that option is available only on the id, text, and gravatar fields.

I understand your feedback that it should raise a warning, but we don't yet have a mechanism to mark fields which universal options they support.

TBH, we'd welcome a PR to support link_to_record on belongs_to. I could see that being helpful.

Approach

We should add this here.

adrianthedev avatar Apr 15 '24 18:04 adrianthedev

Sorry, I missed that. I'll try a PR to make it work.

krystof-k avatar Apr 15 '24 18:04 krystof-k

This issue has been marked as stale because there was no activity for the past 15 days.

github-actions[bot] avatar May 01 '24 01:05 github-actions[bot]

This issue has been marked as stale because there was no activity for the past 15 days.

github-actions[bot] avatar May 17 '24 01:05 github-actions[bot]

This issue has been marked as stale because there was no activity for the past 15 days.

github-actions[bot] avatar Jun 02 '24 02:06 github-actions[bot]

Closing this because there was no activity for the past 15 days. Feel free to reopen if new information pops up ✌️

github-actions[bot] avatar Jun 17 '24 02:06 github-actions[bot]