Class: TopbarSweeper

Inherits:
ActionController::Caching::Sweeper
  • Object
show all
Defined in:
app/controllers/topbar_sweeper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.expire_cache(controller) ⇒ Object


24
25
26
# File 'app/controllers/topbar_sweeper.rb', line 24

def self.expire_cache(controller)
  controller.expire_fragment(TopbarSweeper.fragment_name) if User.current
end

.fragment_nameObject


20
21
22
# File 'app/controllers/topbar_sweeper.rb', line 20

def self.fragment_name
  "tabs_and_title_records-#{User.current.id}"
end

Instance Method Details

#after_create(record) ⇒ Object


4
5
6
# File 'app/controllers/topbar_sweeper.rb', line 4

def after_create(record)
  expire_cache_for(record)
end

#after_destroy(record) ⇒ Object


12
13
14
# File 'app/controllers/topbar_sweeper.rb', line 12

def after_destroy(record)
  expire_cache_for(record)
end

#after_select(record) ⇒ Object


16
17
18
# File 'app/controllers/topbar_sweeper.rb', line 16

def after_select(record)
  expire_cache_for(record)
end

#after_update(record) ⇒ Object


8
9
10
# File 'app/controllers/topbar_sweeper.rb', line 8

def after_update(record)
  expire_cache_for(record)
end