Skip to content
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

Add separator option to grouped_options_for_select #5369

Conversation

Greenie0506
Copy link
Contributor

Added a separator option to the method grouped_options_for_select if provided.

This is a common use case that people are often using optgroups for –– As a way of dividing options in a select.

This is a revision of my earlier pull request:
#5363

@isaacsanders
Copy link
Contributor

@tenderlove @josevalim Any thoughts on this?

@@ -476,13 +476,23 @@ def option_groups_from_collection_for_select(collection, group_method, group_lab
#
# <b>Note:</b> Only the <tt><optgroup></tt> and <tt><option></tt> tags are returned, so you still have to
# wrap the output in an appropriate <tt><select></tt> tag.
def grouped_options_for_select(grouped_options, selected_key = nil, prompt = nil)
Copy link
Contributor

Choose a reason for hiding this comment

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

The signature can be (grouped_options, selected_keys, options={}). If someone pass something different than a hash as options, he's passing the prompt so we should show a deprecation warning.

@Greenie0506
Copy link
Contributor Author

That's a good point, I'll work on making prompt part of the options hash and deprecating it as an argument.

Change prompt to options hash in grouped_options_for_select
@Greenie0506
Copy link
Contributor Author

@josevalim @isaacsanders I've added the prompt as part of the options hash and added a deprecation warning. Let me know what you think.

tenderlove added a commit that referenced this pull request May 16, 2012
…tions_for_select

Add separator option to grouped_options_for_select
@tenderlove tenderlove merged commit 66cbde0 into rails:master May 16, 2012
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.

None yet

4 participants