-
Notifications
You must be signed in to change notification settings - Fork 355
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
Allow to pass block to select helper in Rails >= 4.1.0 #229
Conversation
Beginning with Rails 4.1.0, the select method allows to pass a block to render as the options string: http://apidock.com/rails/v4.1.8/ActionView/Helpers/FormOptionsHelper/select (the link points to 4.1.8, but it is the same for 4.1.0) Adapt the gem to allow this. The test is marked to run on Rails >= 4.1.0 only. One problem remains though: When updating Rails to 4.1.0 in test environment, many other tests fail because the order of attributes in the output changed. I don't know how to solve this yet without rewriting the expected output for different Rails versions (wich is a cumbersome task ...).
👍 I would also appreciate a the ability to use a block with This feature is really useful if you want to generate custom choices for the select element, with e.g. custom |
👍 |
@manuelmeurer, check this please |
@lancedikson I'm not actively involved in development of this project. /cc @potenza |
@manuelmeurer, looks like @potenza is not active on GH at this time 😞 |
@baldwindavid @carloslopes @sethvargo @wingrunr21 Can one of you guys have a look? |
I'm also not actively involved but I don't really see anything wrong with the PR. |
I'm using this for the last months and have no problems with it. Feel free to use the fork. Only problem with this PR is that updating to Rails >= 4.1.0 in test environment makes all other tests fail, because the output order of attributes has changed and the tests depend on this. One would have to rewrite all tests to not depend on ordering, e.g. not comparing output strings exactly but either checking for attributes ( Will there be a rewrite for bootstrap 4? Maybe tests will be rewritten in then, too, then this should be taken in consideration to make tests more stable. |
Hey guys! Sorry about the delay! The code appears to be fine for me, but I'm a little bit concerned about what you said of the Rails 4.1.0 issue. The other examples fail when we use 4.1.0 on test environment? |
Exactly! |
So, the lib breaks if someone uses rails 4.1.0? |
No, just the tests fail due to the way they are written. Example: The tests check that output is exact, for example:
Rails < 4.1 generates this exactly, but Rails >= 4.1 generates:
Only order of attributes changed, but everything is still fine. But test fails of course. Hope you get the point. |
Yep, I'm not currently using the gem anymore. But like different people said that this is fine, I'll merge it |
Allow to pass block to select helper in Rails >= 4.1.0
There's something more you need to be merged? Then I can close a new version |
Beginning with Rails 4.1.0, the select method allows to pass a block to
render as the options string:
http://apidock.com/rails/v4.1.8/ActionView/Helpers/FormOptionsHelper/select
(the link points to 4.1.8, but it is the same for 4.1.0)
Adapt the gem to allow this.
The test is marked to run on Rails >= 4.1.0 only.
One problem remains though: When updating Rails to 4.1.0 in test
environment, many other tests fail because the order of attributes in
the output changed. I don't know how to solve this yet without rewriting
the expected output for different Rails versions (wich is a cumbersome
task ...).