Problems with UserEngine & LoginEngine and Rails 1.2
So I’ve been looking to add some of the new REST functionality to an app I’ve been working on based in Rails 1.1.1 code. What better way then to use the updated functionality found in Rails 1.2. Well the problem is that fact that a long time ago I decided that Engines were a good idea. They provided functionality that was pretty easy to override and was pretty much self contained. That’s what made them a good fit then.
The problem now is that when engines go unsupported like how UserEngine and LoginEngine have with Engines 1.2, it makes it difficult to upgrade Rails. I made the attempt and found out the hard way that ‘config’ which available in previous versions of Engines is no longer available, and the suggested workaround is to use mattr_accessor. This is problematic because if you do that you are essentially making available every configuration option as an actionable method in your controller. The issue here is in the way UserEngine syncs permissions.
The result, every configuration option has a permission object and some actual actionable methods don’t end up with permission objects. Unfortunately I don’t have the solution here, but it seems that the only reason UserEngine and LoginEngine don’t continue to work is because Engines 1.2 dropped some functionality, and it doesn’t really seem due to the fact that either of those engines have offending code…afaik the whole reason to update to Engines 1.2 is because the previous version breaks routing in Rails 1.2.
In retrospect generators seem a billion times better than engines because in this case relying on engines to keep some minimum level of backward compatibility was a big mistake.
For now I have to try to convert these two engines. I’ll repost as I make progress. Someone through me a line.
Long live acts_as_authenticated.

