https://avo.cool logo
Hey folks. I have a `belongs_to` field
# general
s
Hey folks. I have a
belongs_to
field and I want to disable the link to the child resource on the Show view. I've tried everything I can find (link_to_resource, link_to_child_resource, link_to_record, etc) but it almost feels like it's not possible. Any help?
l
Hi @strong-jordan-28908 The belongs to always shows a link on show view (source code: https://github.com/avo-hq/avo/blob/main/app/components/avo/fields/belongs_to_field/show_component.html.erb#L2) What you can do is to use a text field instead to display the value, something lie:
Copy code
ruby
  def fields
    field :user, as: :belongs_to, only_on: :forms
    field :user, as: :text, only_on: :display do
      record.user.name
    end
  end