railsadminteam / rails_admin

RailsAdmin is a Rails engine that provides an easy-to-use interface for managing your data
MIT License
7.88k stars 2.25k forks source link

Resolved a problem with embedded mongoid documents and boolean selectors #3555

Closed rpalackas closed 9 months ago

rpalackas commented 1 year ago

Previous implementation was creating a label with an incorrect for attribute when used on an embedded mongoid document. It would create <label for=parent_class[embedded_class_attributes]_field_name_1 ... when the id of the input field was parent_class_embedded_class_attributes_field_name_1. Because of this the selectors did nothing when clicked since the label references an id that does not exist. This change to using the rails label helper should safely create the label in all cases.

mshibuya commented 1 year ago

Could you write a spec for this fix? https://github.com/railsadminteam/rails_admin/blob/master/spec/integration/fields/boolean_spec.rb will be the good place to add it.

sasselin commented 1 year ago

This fix work. Have the bug with 3.1.2 too. Is not specific to mongo

coveralls commented 11 months ago

Coverage Status

coverage: 96.107%. remained the same when pulling 1df1cc8138821b7448e077a58273e33ab93ad39f on rpalackas:master into 0e12e5b465997c14d5b7a4d500a0d4cebed21aa9 on railsadminteam:master.

rpalackas commented 11 months ago

@mshibuya Are there any known random failures in the specs? According to the CI I've got failures on rails_6.1 and 7 but running those locally passes for me bundle exec appraisal rails-6.1 rspec ... 1099 examples, 0 failures, 1 pending

bundle exec appraisal rails-7.0 rspec ... 1097 examples, 0 failures, 1 pending

rpalackas commented 11 months ago

Well reducing the js scope resolved some of my failures. Not sure what would cause the remaining one though any feedback here would be appreciated

mshibuya commented 9 months ago

I can handle the rest. Thank you!