I’ve decided to collect various hacks and techniques I’ve been using
in my projects to make nested and polymorphic resources a little less
painful to use.
So, while refactoring everything into a single plugin will take time,
I decided to release the first incarnation.
The current version includes support for url helpers that
automagically try to fill in any missing route segments for you.
It’s the sort of feature that’s been done-to-death using various
techniques but this is my own take on solving the problem - with
special attention to runtime performance. As in, there are no costly
per-request evals and/or route re-recognition needed. It’s also the
underpinning I use for handling polymorphic resources.
SVN Repository (trunk):
The README in the svn repository explains what’s already there and
how it works. I’ll keep it updated as I move features in place.
Three things to note if you’re going to use this in your projects:
1 - ResourceFu is rails 1.2 only. It’s not compatible with 1.1 and,
while I track edge rails, my current target is only rails 1.2.
2 - imho, Piston is the best tool to use for managing external
dependencies such as resource_fu. See http://piston.rubyforge.org/
for more information. Personally I’ve had one or two issues with
newer versions of piston so if you have problems, try an older gem
version - 1.3.0 works flawlessly for me.
3 - ResourceFu is a moving target and the svn url above is for
trunk. As I add features I will provide compatibility branches if
method signatures or behavior of existing features change. However,
if you use svn:externals you may be caught-out. See point #3 above
about using Piston