Yesterday I answered a question regarding polymorphic URL helpers on Core ML and noticed that the module has no documentation. I’ve documented it and rewritten unit tests using Mocha. I also optimized some of the code slightly (nothing major, though). The patch also includes two fixes by Geoff Buesing, who has done awesome work in this area in the past.
Check the documentation, please yell if anything is wrong:
What’s still broken? (I decided not to fix everything in one go.)
Hash argument: polymorphic_url(:id => @article). Test is commented out (like before).
Should this work: polymorphic_url(@article, :format => :pdf) ? Currently it doesn’t. I’ve included a failing tests, it’s commented out.
Open ActionPack tickets with “polymorphic” in title:
This one needs a discussion of its own: http://dev.rubyonrails.org/ticket/9621