joshfrench / rakismet

Easy Akismet and TypePad AntiSpam integration for Rails
MIT License
355 stars 46 forks source link

rakismet_attrs not propogated to subclasses #16

Closed igorbernstein closed 12 years ago

igorbernstein commented 12 years ago

Would be possible to inherit rakismet config to subclasses?

class Comment < ActiveRecord::Base
   rakismet_attrs :author => proc { user.full_name }
end

class DiscussionTopic < Comment
end

DiscussionTopic.akismet_attrs
=> nil

Workaround:


class DiscussionTopic < Comment
   self.akismet_attrs = base_class.akismet_attrs.dup
end
joshfrench commented 12 years ago

I just pushed a fix, can you update to Rakismet 1.2.0 and let me know if it solves your issue?

I didn't use base_class because that's ActiveRecord and Rakismet tries not to have any dependencies. I used superclass instead, although you should note that the two have slightly different behaviors: if class C < B < A, C.superclass => B but C.base_class => A. That's probably what you wanted anyway.

Thanks for the suggestion!

igorbernstein commented 12 years ago

Thanks!