- flash.each do |name, message|
  %div{ class: "alert-box #{name}" }
    = message.html_safe
    %a{ href: "#", class: "close" }
      = "&times;".html_safe

- if !request.get? && local_assigns[:model].present? && !model.valid?
  .alert-box.alert
    - message_term = local_assigns[:term] ? term : model.class.name.humanize.downcase
    .italic= "#{pluralize(model.errors.count, "error")} prohibited this #{message_term} from being saved:"
    %ul
      - model.errors.full_messages.each do |message|
        %li= message

- display_flash = local_assigns.has_key?(:display_flash) ? display_flash : true
- if display_flash
  - flash.each do |name, message|
    %div{ class: "alert-box #{name}" }
      = message.html_safe
      %a{ href: "#", class: "close" }
        = "&times;".html_safe

- if !request.get? && local_assigns.has_key?(:model) && !model.valid?
  .alert-box.alert
    - message_term = local_assigns.has_key?(:term) ? term : model.class.name.humanize.downcase
    .italic= "#{pluralize(model.errors.count, "error")} prohibited this #{message_term} from being saved:"
    %ul
      - model.errors.full_messages.each do |message|
        %li= message

Use local_assigns has_key instead of present and allow to optionally display flash messages
Use local_assigns has_key instead of present and allow to optionally display flash messages
