Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed: Method should be in Watchable not Watcher

  • Loading branch information...
commit 08d1b14c85303633b46bea08ccc4c05c1281609a 1 parent 17c41ab
@sickboy authored
Showing with 13 additions and 13 deletions.
  1. +13 −0 lib/make_watchable/watchable.rb
  2. +0 −13 lib/make_watchable/watcher.rb
View
13 lib/make_watchable/watchable.rb
@@ -10,6 +10,19 @@ module ClassMethods
def watchable?
true
end
+
+ # Method to find the ActiveRecord base class in case of STI
+ # Required due to issue where Polymorphic models list their base class in the association
+ # Thus we should also search for the baseclass when querying
+ def sti_base_class
+ return @sti_base_class unless @sti_base_class.nil?
+ klass = self.class
+ self.class.ancestors.each do |k|
+ break if k == ActiveRecord::Base # we reached the bottom of this barrel
+ klass = k if k.is_a? Class
+ end
+ @sti_base_class = klass
+ end
end
def watched_by?(watcher)
View
13 lib/make_watchable/watcher.rb
@@ -10,19 +10,6 @@ module ClassMethods
def watcher?
true
end
-
- # Method to find the ActiveRecord base class in case of STI
- # Required due to issue where Polymorphic models list their base class in the association
- # Thus we should also search for the baseclass when querying
- def sti_base_class
- return @sti_base_class unless @sti_base_class.nil?
- klass = self.class
- self.class.ancestors.each do |k|
- break if k == ActiveRecord::Base # we reached the bottom of this barrel
- klass = k if k.is_a? Class
- end
- @sti_base_class = klass
- end
end
# Watch a +watchable+.
Please sign in to comment.
Something went wrong with that request. Please try again.