Method: Padrino::Helpers::AssetTagHelpers#link_to
- Defined in:
- padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb
permalink #link_to(caption, url, options = {}) ⇒ String #link_to(url, options = {}, &block) ⇒ String
Creates a link element with given name, url and options.
Note that you can pass :if
or :unless
conditions, but if you provide :current as condition padrino return true/false if the request.path_info match the given url.
84 85 86 87 88 89 90 91 |
# File 'padrino-helpers/lib/padrino-helpers/asset_tag_helpers.rb', line 84 def link_to(*args, &block) = args.last.is_a?(Hash) ? args.pop : {} name = block_given? ? '' : args.shift href = args.first = { :href => href ? escape_link(href) : '#' }.update() return name unless parse_conditions(href, ) block_given? ? content_tag(:a, , &block) : content_tag(:a, name, ) end |