Skip to content

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

Merged
mshibuya merged 5 commits into
railsadminteam:masterfrom
rpalackas:master
Nov 25, 2023
Merged

Resolved a problem with embedded mongoid documents and boolean selectors#3555
mshibuya merged 5 commits into
railsadminteam:masterfrom
rpalackas:master

Conversation

@rpalackas

Copy link
Copy Markdown
Contributor

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.

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

mshibuya commented Oct 8, 2022

Copy link
Copy Markdown
Member

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

sasselin commented Apr 4, 2023

Copy link
Copy Markdown

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

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.
@coveralls

Copy link
Copy Markdown

Coverage Status

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

@rpalackas

Copy link
Copy Markdown
Contributor Author

@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

Copy link
Copy Markdown
Contributor Author

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

Copy link
Copy Markdown
Member

I can handle the rest. Thank you!

@mshibuya mshibuya merged commit 8708722 into railsadminteam:master Nov 25, 2023
mshibuya added a commit that referenced this pull request Nov 25, 2023
Reuse content column instead of adding a new boolean one, as modifying an old migration doesn't change existing databases
jklimke added a commit to 3dcl/rails_admin that referenced this pull request Nov 28, 2023
* 'master' of github.com:railsadminteam/rails_admin:
  Tidy up gemfiles
  Bump jRuby
  Test against Mongoid 8
  Test against Rails 7.1
  Mitigate jRuby build failures
  Upgrade node and vite to fix the vite build
  Un-pin turbo-rails to fix Rails 6.1 builds
  Follow-up for railsadminteam#3555
  Resolved a problem with embedded mongoid documents and boolean selectors (railsadminteam#3555)
  Stop using update_only to decide to show subform on create (railsadminteam#3649)
  Follow-up for railsadminteam#3643
  Basic vite integration attempt (railsadminteam#3643)
  Support client-side dynamic scoping
  Fix Rubocop offense
  Revive the live demo
  Unlock webrick version
  Fix typo: tripple ==> triple (railsadminteam#3637)
  Replace &rdquo; entity with inline <q> element (railsadminteam#3636)
  Vulnerability fix: validate return_to param using request.host (railsadminteam#3627)
  Fix Rubocop offense
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants