Topic: Plugin help
I've written a plugin which patches ActiveRecord, much like acts_as_paranoid, but I would like the patch to be applied to all models that inherit from ActiveRecord. The only examples of plugins which patch ActiveRecord that I can find, simply rely on the user entering "acts_as_paranoid" or some similar method name in each model. I'd like this plugin to automatically be applied to every ActiveRecord model.
Below is a snippet of the module which gets included in ActiveRecord when the plugin loads:
alias_method :original_update_attributes, :update_attributes
class << self
alias_method :original_new, :new
Does anyone have an idea of a way that I can get this plugin to be automatically applied to each model?
Edit: I read the other recent thread about mixins and the solution proposed there did not work. My include logic looks like:
ActiveRecord::Base.send :include, Viget::Permissions::AdminMassAssignment
and yet the models don't seem to know I've patched them without explicitly stating "admin_mass_assignment" in each of them.
Last edited by Weexpectedthis (2007-08-01 08:51:54)
Santa Clara, CA - Startontop