Module: Trestle::FlashHelper

Included in:
Controller::Helpers
Defined in:
app/helpers/trestle/flash_helper.rb

Overview

Internal

Instance Method Summary collapse

Instance Method Details

#debug_form_errors?Boolean

Returns:

  • (Boolean)


8
9
10
# File 'app/helpers/trestle/flash_helper.rb', line 8

def debug_form_errors?
  Trestle.config.debug_form_errors && instance_has_errors?
end

#instance_has_errors?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'app/helpers/trestle/flash_helper.rb', line 12

def instance_has_errors?
  instance.errors.any? rescue false
end

#normalize_flash_alert(flash) ⇒ Object



4
5
6
# File 'app/helpers/trestle/flash_helper.rb', line 4

def normalize_flash_alert(flash)
  flash.is_a?(Hash) ? flash.with_indifferent_access : { message: flash }
end