In Rails, you are used to doing something like this:
1 2 3 4 5 |
|
This way, if you call parent_record.assignments.root
, the root method
acts on the array of assignments that belong to that parent. It’s nice.
However, in Rails 3.1 you will see a big scary message in your logs, or
in your test output.
1
|
|
I will admit that it is not very frightening, actually. It is mostly merely annoying… annoying as hell. Get out of my test output!
The working solution that I found looks like this:
1 2 3 4 5 |
|
This functionality is now defined in collection_proxy.rb, which was quite a bit of help in finding this solution. Bid those deprecation warnings adieu!
PS – I do not know whether this is the core-team accepted solution. I am certainly happy to see a better one!