This project is archived and is in readonly mode.
String#parameterize should accept a custom separator
Reported by Miha Filej | September 25th, 2008 @ 03:46 PM | in 2.x
This tiny patch allows String#parameterize to receive an argument as ActiveSupport::Inflector.parameterize does.
Also added tests for String#parameterize as they were missing.
Comments and changes to this ticket
-
Yaroslav Markin December 25th, 2008 @ 09:12 PM
- Assigned user set to Pratik
I believe this is already done, can we close?
activesupport/lib/active_support/inflector.rb 259: def parameterize(string, sep = '-')
-
Frederick Cheung December 25th, 2008 @ 09:50 PM
I don't think that's the point - The point is that String#parameterize doesn't allow you to specify the separator argument that is passed to Inflector.parameterize
-
Miha Filej December 25th, 2008 @ 09:52 PM
Yaroslav, the code you cited refers to activesupport/lib/active_support/inflector.rb which is not affected by the patch.
The purpose of this ticket is to allow
some_string.parameterize("_") # instead of "La, la, la!".parameterize.dasherize # or ActiveSupport::Inflector.parameterize "La, la, la!", "_"
Would anyone consider applying if I rebase the patch against master?
-
Miha Filej December 25th, 2008 @ 09:55 PM
"dasherize" should be "underscore". And also Frederick was quicker than me :)
-
Pratik December 25th, 2008 @ 09:58 PM
I don't think the tests for this need to use mocking/stubbing.
Thanks.
-
Miha Filej December 25th, 2008 @ 10:07 PM
So should I just test for some output? Because this is kinda already done in InflectorTest#test_parameterize.
-
Sam Granieri March 6th, 2009 @ 08:36 PM
I also made a fix for this problem... probably should not have duplicated efforts
-
Cheah Chu Yeow May 12th, 2009 @ 06:11 PM
- Tag changed from activesupport, core_ext, patch, tests, tiny to activesupport, core_ext, duplicate, patch, tests, tiny
Since Sam's patch from http://rails.lighthouseapp.com/p... has been committed, I guess we should close this ticket.
-
Pratik May 12th, 2009 @ 06:12 PM
- State changed from new to duplicate
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>