Stymied trying to extend AR with Plugin

Greg Willits wrote:
> Lots of code below, since it's usually the details that matter. Bit of a
> long one, but I think it's generic enough to be a good one for the
> archives.

OK, nevermind -- got it sorted out.

required this change:

def self.append_features(base_module)
base_module.before_create do |model|
model.attributes.each do |key,value|
if model.class.attributes_to_scrub.include?(key.to_sym)
model.scrub_value(value) if !value.nil?
end
end
end
end

In case you're curious why, that;s because blocks are closures - in
particular they remember self, so you were trying to call scrub_value
on the module, read that variable form the module etc.

Fred