Module: RenderComponent::Components::MethodsToPrepend

Defined in:
lib/render_component/components.rb

Instance Method Summary collapse

Instance Method Details

#___flash(refresh = false) ⇒ Object

broken, flash never disappear



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/render_component/components.rb', line 13

def ___flash(refresh = false) #:nodoc:
  if @component_flash.nil? || refresh
    @component_flash =
      if parent_controller&.flash.is_a?(ActionDispatch::Flash::FlashHash)
        parent_controller.flash
      elsif session['flash'].is_a? Array
        session['flash'] = ActionDispatch::Flash::FlashHash.new(session['flash'].to_h)
      else
        session['flash'] ||= ActionDispatch::Flash::FlashHash.new
      end
  end
  @component_flash
end

#sessionObject



4
5
6
7
8
9
10
# File 'lib/render_component/components.rb', line 4

def session
  if parent_controller.present?
    parent_controller.session
  else
    @_request.session
  end
end