Module: Trestle::FlashHelper

Defined in:
app/helpers/trestle/flash_helper.rb

Instance Method Summary collapse

Instance Method Details

#debug_form_errors?Boolean

Returns:

  • (Boolean)

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

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

#instance_has_errors?Boolean

Returns:

  • (Boolean)

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

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

#normalize_flash_alert(flash) ⇒ Object


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

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