Skip to content

Rename check_box in checkbox #52432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2024
Merged

Rename check_box in checkbox #52432

merged 1 commit into from
Jul 28, 2024

Conversation

byroot
Copy link
Member

@byroot byroot commented Jul 28, 2024

But add aliases for backward compatibility.

Fix: #52430

But add aliases for backward compatibility.

Fix: rails#52430
@byroot byroot merged commit c01ee68 into rails:main Jul 28, 2024
1 of 3 checks passed
@byroot byroot deleted the checkbox branch July 28, 2024 11:40
# <%= f.submit %>
# <% end %>
#
# Please refer to the documentation of the base helper for details.
def collection_check_boxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
@template.collection_check_boxes(@object_name, method, collection, value_method, text_method, objectify_options(options), @default_html_options.merge(html_options), &block)
def collection_checkboxes(method, collection, value_method, text_method, options = {}, html_options = {}, &block)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi @byroot I think you forgot to add an alias here as well as in line 782
(sorry about the screenshot without context but i could reproduce it on our prod app )
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I opened #52436

@@ -779,7 +779,7 @@ def collection_radio_buttons(object, method, collection, value_method, text_meth
#
# In the rare case you don't want this hidden field, you can pass the
# <tt>include_hidden: false</tt> option to the helper method.
def collection_check_boxes(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block)
def collection_checkboxes(object, method, collection, value_method, text_method, options = {}, html_options = {}, &block)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here as well

byroot pushed a commit that referenced this pull request Jul 29, 2024
Related to #52432
seanpdoyle added a commit to seanpdoyle/rails that referenced this pull request Jul 30, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
seanpdoyle added a commit to seanpdoyle/rails that referenced this pull request Jul 31, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
seanpdoyle added a commit to seanpdoyle/rails that referenced this pull request Jul 31, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
@seanpdoyle
Copy link
Contributor

I've opened #52467 in the same spirit of this PR. It renames text_area_tag to textarea_tag and rich_text_area_tag to rich_textarea_tag, while preserving backward compatibility with aliases.

seanpdoyle added a commit to seanpdoyle/rails that referenced this pull request Jul 31, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
heka1024 pushed a commit to heka1024/rails that referenced this pull request Aug 1, 2024
@spickermann
Copy link
Contributor

I guess it would make sense to deprecate check_box and output a warning at some point. And then removing it in a later version.

Does Ruby on Rails have some kind of guideline or recommendation when to alias or when to deprecate a method? And how long to keep the old version?

@byroot
Copy link
Member Author

byroot commented Aug 4, 2024

This isn't something worth deprecating, it's a simple alias.

@connorgurney-me
Copy link

This is perhaps one of the most monumental changes to Rails in forever! 😆 Kudos.

joelhawksley pushed a commit to joelhawksley/rails that referenced this pull request Aug 8, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
joelhawksley pushed a commit to joelhawksley/rails that referenced this pull request Aug 8, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
DanielaVelasquez pushed a commit to DanielaVelasquez/rails that referenced this pull request Oct 3, 2024
DanielaVelasquez pushed a commit to DanielaVelasquez/rails that referenced this pull request Oct 3, 2024
Follow-up to [rails#52432][]
Related to [rails#52430][]

Helpers like `text_area_tag` construct [textarea][] elements. This
commit renames all view helper and form builder methods to replace
occurrences of `text_area` with `textarea`.

In the same style, this commit also renames the `rich_text`-prefixed
helpers to utilize a `textarea` suffix instead of the existing
`text_area` suffix.

To preserve backwards compatibility, this commit defines aliases for the
existing `text_area` format.

[rails#52432]: rails#52432
[rails#52430]: rails#52430
[textarea]: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea
Earlopain added a commit to Earlopain/tailwindcss-rails that referenced this pull request Oct 9, 2024

Verified

This commit was signed with the committer’s verified signature.
They got renamed in:
* rails/rails#52432
* rails/rails#52467

This ensures the correct classes are generated for both old and new versions
@Earlopain
Copy link
Contributor

Earlopain commented Oct 9, 2024

This puts generators in an akward place where they need to handle both variants if they want to properly support both old and new rails versions. rails/tailwindcss-rails#418 Would it make sense to still return the old version from field_type? Nope, field_type is obviously used to generate what ends up in the generated file so having that return the old value would also generate old method names. Not sure what would be an appropriate backwards compatible change, if there is any.

Maybe it's fine? It looks like that whole thing is undocumented actually. I don't know enough about generators (zero to none actually) to be able to tell.

flavorjones pushed a commit to rails/tailwindcss-rails that referenced this pull request Oct 10, 2024

Verified

This commit was signed with the committer’s verified signature.
flavorjones Mike Dalessio
They got renamed in:
* rails/rails#52432
* rails/rails#52467

This ensures the correct classes are generated for both old and new versions

(cherry picked from commit 68d819a)
KingStar365 added a commit to KingStar365/RubyonRails_TailwindCSS that referenced this pull request Mar 8, 2025
They got renamed in:
* rails/rails#52432
* rails/rails#52467

This ensures the correct classes are generated for both old and new versions

(cherry picked from commit 68d819afc165f3b74226130cabec334a8ce8b9d3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can we have a checkbox alias?
6 participants