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