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

Create a recipe: multiple fields using same ID (order and translation fix) #149

Open
adrianthedev opened this issue Dec 18, 2023 · 0 comments

Comments

@adrianthedev
Copy link
Contributor

From here: avo-hq/avo#1796 (comment)

Teach people how to use same field name but different field id on different situations example:

with_options only_on: :index do
  field :id, as: :id
  field :name, as: :text
  field :dogs_tags, as: :tags, translation_key: "avo.field_translations.dogs" do |model, resource, view|
    model.dogs.pluck(:name)
  end
end

with_options only_on: :show do
  field :id, as: :id
  field :name, as: :text
  field :dogs, as: :has_many
end

We're using a translation key on the index in order to get the dogs field on the UI but with a different type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

No branches or pull requests

1 participant