Skip to content
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

link_to_record should override link to association or throw warning #2689

Open
4 of 11 tasks
krystof-k opened this issue Apr 15, 2024 · 4 comments
Open
4 of 11 tasks

link_to_record should override link to association or throw warning #2689

krystof-k opened this issue Apr 15, 2024 · 4 comments

Comments

@krystof-k
Copy link
Contributor

krystof-k commented Apr 15, 2024

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:

  • Community
  • Pro
  • Advanced

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

  • Yes. If so, please post code samples.
  • No

Impact

  • High impact (It makes my app un-usable.)
  • Medium impact (I'm annoyed, but I'll live.)
  • 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.)
  • Low urgency (It can wait. I just wanted you to know about it.)
@adrianthedev
Copy link
Collaborator

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.

@krystof-k
Copy link
Contributor Author

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

Copy link
Contributor

github-actions bot commented May 1, 2024

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

@github-actions github-actions bot added the Stale label May 1, 2024
@Paul-Bob Paul-Bob removed the Stale label May 1, 2024
Copy link
Contributor

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

@github-actions github-actions bot added the Stale label May 17, 2024
@Paul-Bob Paul-Bob removed the Stale label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants