view app/helpers/application_helper.rb @ 440:f4612faedb9e

hybrid for migration
author nanaya <me@myconan.net>
date Sat, 02 Jul 2016 17:26:21 +0900
parents d31fe32da7a0
children 68231013b01b
line wrap: on
line source

module ApplicationHelper
  def html_title
    base_title = "Zeropaste"
    if content_for? :title
      "#{content_for(:title)} | #{h base_title}".html_safe
    else
      base_title
    end
  end

  def error_class(object, attribute)
    "has-error" if object.errors.include? attribute
  end

  def with_host(url)
    return url if url[0] != "/"

    "#{request.protocol}#{request.host_with_port}#{url}"
  end
end