This project is archived and is in readonly mode.
active_support/core_ext/array/random_access.rb conflicts with standard Ruby library
-
djbob
Ermm, probably change that ">" into a ">=" in the included file.
-
Dan Pickett
- Tag changed from active_support core_ext to active_support core_ext, bugmash
can someone work to create a patch in accordance with http://rails.lighthouseapp.com/projects/8994/sending-patches? Other bugmashers can then verify and pass the issue over for core review.
-
Santiago Pastorino
- Milestone cleared.
- Tag changed from active_support core_ext, bugmash to active_support core_ext, bugmash, patch
- State changed from new to verified
- Assigned user set to Santiago Pastorino
Patches for master and 2-3-stable attached
-
Xavier Noria
The method Kernel#rand can be called in a procedural style. It is technically a private method of any class because it is defined that way in Kernel as a trick. The same happens with Kernel#gsub and others, you can call [].gsub, and you'll get an error message about a private method. A hack is leaking.
I think a 3rd party library should be able to extend Array and expect a call to rand with no receiver to be calling Kernel#rand.
Since Array#rand has nothing to do with Kernel#rand, I think that it is not a good solution to change the signature and choose the implementation based on the argument. Additionally, Kernel#rand can be called with no argument, but this is secondary, my main point is the previous one.
I believe we should rename Array#rand instead.
-
Rizwan Reza
Anything on this one, considering Xavier's comment?
-
Rizwan Reza
- State changed from verified to open
-
Eric Hutzelman
Anyone in favor of Array#random or Array#random_element? Is it worth the deprecation to make this kind of change?
-
Xavier Noria
I prefer random_element, since random (and rand) are a bit ambiguous in my view and could also mean shuffle.
This method has been there for a long time, I think it is more likely that Rails developers and plugins use it than 3rd party libraries are extending Array and using rand.
Thus, I think it has to be renamed but I also think it is worth a deprecation cycle to ease migration to Rails 3. We can wait until 3.1 or something. If we just change what #rand returns that's going to be a subtle bug for people.
-
Wijnand Wiersma
+1 for Xaviers comment. Rename it but use a deprecation cycle.
-
José Valim
- Tag changed from active_support core_ext, bugmash, patch to active_support core_ext, patch
-
Santiago Pastorino
- Assigned user changed from Santiago Pastorino to Xavier Noria
patch for both master and 2-3-stable
-
Repository
- State changed from open to committed
(from [821e15e5f2d9ef2aa43918a16cbd00f40c221e95]) Change on Array extension from rand => random_element [#4555 active_support/core_ext/array/random_access.rb conflicts with standard Ruby l... state:committed]
Signed-off-by: Xavier Noria fxn@hashref.com
http://github.com/rails/rails/commit/821e15e5f2d9ef2aa43918a16cbd00... -
Jeremy Kemper
- State changed from committed to open
The master patch deprecates but does not fix. Since 3.0 is unreleased yet, we can remove
randthere and deprecate it in 2-3-stable. -
Rizwan Reza
- Tag changed from active_support core_ext, patch to active_support core_ext, bugmash-review, patch
- State changed from open to verified
The patches accommodate JK's suggestions.
-
Rizwan Reza
Removed relevant tests added them in 2-3-stable.
-
Rizwan Reza
Please apply these patches on top of the ones above.
-
Santiago Pastorino
Didn't understand yet why this https://rails.lighthouseapp.com/projects/8994/tickets/4555/a/522934... (The latest i did for 2-3-stable) was re done.
For me seems ok. -
Xavier Noria
Santiago, the one for 2.3 was not applied because of the assert_deprecated block. I had it in my TODO but then the thread moved on.
-
Rizwan Reza
(from [32b0b5f7b25a05179981d97d6b47aa4a1c683f2f]) Deprecate Array#rand in favor of Array#random_element [#4555 active_support/core_ext/array/random_access.rb conflicts with standard Ruby l... stated:committed]
Signed-off-by: Xavier Noria fxn@hashref.com
http://github.com/rails/rails/commit/32b0b5f7b25a05179981d97d6b47aa... -
Santiago Pastorino
This issue could be closed now, right?
-
Santiago Pastorino
- State changed from verified to resolved
-
Marc-André Lafortune
I'm surprised nobody pointed out that Array#sample is what it should be called, since that's what exists natively in Ruby 1.9. Ideally it should also support an optional parameter.
My implementation passes RubySpec, so activesupport could adapt it: http://github.com/marcandre/backports/blob/master/lib/backports/1.8...
Let me know if I should open a different ticket.
-
Xavier Noria
Thank you very much Marc-André, I removed #random_element altogether and backported Array#sample using your implementation: http://github.com/rails/rails/commit/67a43554f153a3ddb97039b5fac305...
-
Rizwan Reza
- Tag changed from active_support core_ext, bugmash-review, patch to active_support core_ext, patch
-
teiddy
Instructions: download and untar to /sites/all/modules
also - Download and install 'Rules' module to /sites/all/modules
Run /update.php
Goto Admin>Build>Modules, enable "OA Single Group Login Redirect" module and allow Rules module to be activated when prompted.
Log-out as admin and log-in as user with 1 group - page redirects as expected.
Greyside Thank-you!
Thank you for this information,I like it very much,Would you lik a pair of
Pachuco Suits
pack linen clothes
pack suit into suit
pant length
pant length for menpaul smith mens suits
Welcome to our store,We have the best service team!
