platanus / activeadmin_addons

Extends ActiveAdmin to enable a set of great optional UX improving add-ons
MIT License
763 stars 288 forks source link

Ajax Select2 doesn't show validation errors #406

Closed thisismydesign closed 1 year ago

thisismydesign commented 2 years ago

When I use f.input :user, as: :select validation errors on the user correctly show up. However, if I do f.input :user_id, as: :search_select, ... validation errors no longer show up.

I assume this is because the errors belong to user and not user_id. Any ideas how to solve this?

Doc says

Notice we're using the relation field name, not the relation itself, so you can't use f.input :category.

Unfortunately this seems to be true.

A workaround is using f.semantic_errors.

difernandez commented 1 year ago

@thisismydesign thanks for reporting this! We just merged a PR that would fix this by changing the input to work with the association instead of the id, like it is with regular selects. It will be included in the next v2 release

thisismydesign commented 1 year ago

@difernandez Awesome, thanks! This will make the feature much more intuitive to use :)