Hello again all,
Development continues apace towards the 1.2 release of the engines
plugin. As I mentioned previously, I’m taking this release as an
opportunity to make things simpler internally. One of the most
significant chunks of code in the current public release of engines is
the fixture code, and I’m toying with dropping it in 1.2. Here’s the
rational.
When I first put together the ‘login_engine’, it occured to me that
people might not want to always use the same table name for their user
accounts - they might want “user”, or “account”, or “registration” or
whatever else. In order to allow these “engines” to work (and be
tested) with a user-specified table name, I had to be able to load a
fixture file with a fixed name into an arbitrarily-named table.
Because Rails’ fixtures method derives the appropriate table (and
class) from the fixtures file name, it wasn’t flexible enough to
support this.
Duane J.'s great patch (http://dev.rubyonrails.org/ticket/1911)
solved exactly this problem, so with his permission I used essentially
that exact code to support this ‘flexible fixtures’ requirement of the
login_engine as it stood. However, it’s by far the most complex piece
of code in the engines plugin, and it’s increasingly difficult to
maintain as Rails changes and evolves. The functionality his patch
provides should be in core, but we’ll see if that ever actually
happens.
My own personal opinion about allowing developers to use the
login_engine (or other plugins) with any table name has also evolved.
To support this generality, the complexity of the code hugely
increases (both in the engines plugin to support it, and in the
engine/plugin to allow arbitrary tables to be used), basically to the
point where I don’t think it’s worth it anymore. I’m also moving away
from using fixtures anyway, towards creating the test data in code
instead - but that’s just me.
It’s important to note that I’m not talking about dropping support for
fixtures in plugins; rather I’m talking about not including the patch
which allows fixtures to be loaded into arbitrary tables in the
engines plugin anymore.
So - thoughts? Does anyone really need this functionality?