Class: DomainSessionSweeper

Inherits:
ActiveModel::Observer
  • Object
show all
Defined in:
app/controllers/domain_session_sweeper.rb

Class Method Summary collapse

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

Returns:

  • (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

#changedObject



19
20
21
# File 'app/controllers/domain_session_sweeper.rb', line 19

def changed
  self.class.domain_changes = true
end