Class: Auth::Observer
- Inherits:
-
ActiveRecord::Observer
- Object
- ActiveRecord::Observer
- Auth::Observer
- Defined in:
- lib/auth/observer.rb
Class Method Summary collapse
-
.observe(*models) ⇒ Object
Attaches the observer to the supplied model classes.
- .observed_classes ⇒ Object
Instance Method Summary collapse
Class Method Details
.observe(*models) ⇒ Object
Attaches the observer to the supplied model classes.
6 7 8 9 10 11 |
# File 'lib/auth/observer.rb', line 6 def observe(*models) models.flatten! models.collect! { |model| model.is_a?(Symbol) ? model.to_s.camelize.constantize : model } observed_classes.concat models observed_classes.uniq! end |
.observed_classes ⇒ Object
13 14 15 |
# File 'lib/auth/observer.rb', line 13 def observed_classes @observed_classes ||= [] end |
Instance Method Details
#observed_classes ⇒ Object
18 19 20 |
# File 'lib/auth/observer.rb', line 18 def observed_classes Set.new(self.class.observed_classes) end |