-
-
Notifications
You must be signed in to change notification settings - Fork 306
Closed
Labels
Developer Experience (DX)Good first issueGood for newcomersGood for newcomersHelp wantedWe could use some help with thisWe could use some help with this😎 Cool
Description
Context
The format_using option is useful for formatting the output of a field, but it applies to both display and edit views. This often requires conditional logic to ensure proper behavior in different contexts. For example:
field :item, as: :text, format_using: -> {
view.display? ? link_to(value, record.item_link, target: "_blank") : value
}To simplify this, lets introduce a decorate option. This would function similarly to format_using, but only apply to display views (e.g., Show and Index), keeping the edit form unaffected.
With decorate, the same behavior could be achieved more cleanly:
field :item, as: :text, decorate: -> {
link_to(value, record.item_link, target: "_blank")
}Metadata
Metadata
Assignees
Labels
Developer Experience (DX)Good first issueGood for newcomersGood for newcomersHelp wantedWe could use some help with thisWe could use some help with this😎 Cool
Type
Projects
Status
Done