Sha256: dd94730671bc8406d9052204910febfd0902ae6dabec33bb7c7e739f3f1cdf63

Contents?: true

Size: 345 Bytes

Versions: 14

Compression:

Stored size: 345 Bytes

Contents

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

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
trestle-0.9.8 app/helpers/trestle/flash_helper.rb
trestle-0.9.7 app/helpers/trestle/flash_helper.rb
trestle-0.9.6 app/helpers/trestle/flash_helper.rb
trestle-0.9.5 app/helpers/trestle/flash_helper.rb
trestle-0.9.4 app/helpers/trestle/flash_helper.rb
trestle-0.9.3 app/helpers/trestle/flash_helper.rb
trestle-0.9.2 app/helpers/trestle/flash_helper.rb
trestle-0.9.1 app/helpers/trestle/flash_helper.rb
trestle-0.9.0 app/helpers/trestle/flash_helper.rb
trestle-0.8.13 app/helpers/trestle/flash_helper.rb
trestle-0.8.12 app/helpers/trestle/flash_helper.rb
trestle-0.8.11 app/helpers/trestle/flash_helper.rb
trestle-0.8.10 app/helpers/trestle/flash_helper.rb
trestle-0.8.9 app/helpers/trestle/flash_helper.rb