This project is archived and is in readonly mode.
"warning: default 'to_a' will be obsolete" from method_missing in association_proxy
-
David Trasbo
- Assigned user set to Rohit Arondekar
What you're seeing is a warning Rails throws because of some code in an third party gem. The fix should go in that gem - there's a reason Rails throws the warning, and it's there to remind people to fix their code.
This can be closed.
-
Greg Hazel
Fix their code to say what? They are not using Object#to_a, they are using [*val].
-
Rohit Arondekar
- Importance changed from to Low
It certainly looks like an issue of ar-extensions. Can you try opening a ticket/issue there? :)
-
Rohit Arondekar
- State changed from new to invalid
-
Greg Hazel
And what should I request that they do differently? Rails is throwing a warning about to_a, what is the solution?
-
Greg Hazel
FYI, it was filed 8 months ago, with no response: http://github.com/zdennis/ar-extensions/issues#issue/6
It's not clear what other code should do here. Rails should remove the warning, or make some indication about alternatives.
-
Rohit Arondekar
- State changed from invalid to new
Greg, somebody provided a patch in that ticket: http://github.com/thillerson/ar-extensions/commit/fc0cab906ebc3766f... The patch is for ar-extensions. Can you try commenting on that ticket and see if the author responds?
-
Greg Hazel
Well, we'll see. The developer obvious has not done anything with the extension for some time.
The to_a function is (maybe, eventually) being obsoleted by Ruby -- I don't see why Rails needs to try to enforce that by spamming my logs.
-
Rohit Arondekar
Can you try applying that patch manually to see if it fixes the issue?
-
David Trasbo
Greg,
to_ais not obsoleted by Ruby, that's not what the warning says. As I said that warning can't just be removed because you don't want your logs spammed because of code in another gem. There's a reason this warning is thrown.Yes,
to_ais called implicitly here, but that doesn't matter. Rails doesn't know better. -
Greg Hazel
What is the reason the warning is thrown? It is not informative to me.
-
David Trasbo
The warning is thrown because calling
to_aon an instance ofAssociationProxywill be obsolete just like the warning says. Once again: There's a perfectly good technical reason this warning is thrown, and it's there to remind people to fix there code - removing a warning doesn't fix the cause of the warning.Please do close this ticket.
-
David Trasbo
s/there/their
-
Rohit Arondekar
- State changed from new to invalid
-
Greg Hazel
Can you suggest how the issue should be solved? The code which generates this error is not even using to_a, it's using the splat operator.