Add option to sort by an attribute before validation of has_many members with indexed errors

14 views
Skip to first unread message

André Hester

unread,
Oct 19, 2017, 4:13:31 PM10/19/17
to Ruby on Rails: Core
I would like to introduce an option order_before_validation for has_many associations:
If you add new objects via an Rails API to an `has_many` association via nested attributes and you would like to keep the order of the collection sorted by an attribute the matching of the errors via `index_errors` to form input´s can be hard. You can add an `order` attribute that you set manually on client side after re-ordering or adding new items and order the collection before validation. Validation errors can easily assigned to the associated input´s in the form via the index.

Do you think it it worthy merging into Rails Core?


Best regards
André
Reply all
Reply to author
Forward
0 new messages