avo-hq/avo

link_to_record: true, remember ?via_record_id=xxx&via_resource_class=yyy

開放

#3,475 建立於 2024年12月2日

 (2 則留言) (0 個反應) (0 位負責人)Ruby (308 個分叉)user submission
EnhancementHelp wantedStale exempt

倉庫指標

星標
 (1,778 顆星)
PR 合併指標
 (平均合併 1天 6小時) (30 天內合併 67 個 PR)

描述

Feature

see https://www.loom.com/share/eb42935e2725476f945e60b79ff84d40

When clicking on rows within an association and you have the link_to_record: true, we go the right record ✅ but forget the association ❌ which makes the user experience inconsistent This is especially the case with the global config.click_row_to_view_record = true which does the right thing on all non belongs-to columns, but forgets about the via_record_id parameter on belongs_to fields...

# resource 1 (table)
field :columns, as: :has_many

# resource 2 (columns)
def fields
        field :foobar, as: :belongs_to, link_to_record: true # correctly will open the `column` resource (i.s.o. foobar) yet forgets about the table (resource 1)
end

Current workarounds

switch all :belongs_to to :text and format_using in !view.form? but feels very dirty

貢獻者指南