Class: DomainSessionSweeper
- Inherits:
-
ActiveModel::Observer
- Object
- ActiveModel::Observer
- DomainSessionSweeper
- Defined in:
- app/controllers/domain_session_sweeper.rb
Class Method Summary collapse
- .after(controller) ⇒ Object
- .before(controller) ⇒ Object
- .domain_changes=(bool) ⇒ Object
- .domain_changes? ⇒ Boolean
Instance Method Summary collapse
Class Method Details
.after(controller) ⇒ Object
8 9 10 |
# File 'app/controllers/domain_session_sweeper.rb', line 8 def self.after(controller) controller.session[:domain] = nil if self.domain_changes? end |
.before(controller) ⇒ Object
4 5 6 7 |
# File 'app/controllers/domain_session_sweeper.rb', line 4 def self.before(controller) self.domain_changes = false true end |
.domain_changes=(bool) ⇒ Object
15 16 17 |
# File 'app/controllers/domain_session_sweeper.rb', line 15 def self.domain_changes=(bool) Thread.current[:domain_sweeper] = bool end |
.domain_changes? ⇒ Boolean
12 13 14 |
# File 'app/controllers/domain_session_sweeper.rb', line 12 def self.domain_changes? Thread.current[:domain_sweeper] end |
Instance Method Details
#after_destroy(domain) ⇒ Object
26 27 28 |
# File 'app/controllers/domain_session_sweeper.rb', line 26 def after_destroy(domain) changed end |
#after_save(domain) ⇒ Object
23 24 25 |
# File 'app/controllers/domain_session_sweeper.rb', line 23 def after_save(domain) changed end |
#changed ⇒ Object
19 20 21 |
# File 'app/controllers/domain_session_sweeper.rb', line 19 def changed self.class.domain_changes = true end |