Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
# allows for <%= link_to @person %> and <%= link_to [@company, @person] %> # link text is the #to_s representation of the object, or if an array is passed, the last object in the array # works nicely with Mislav Marohnić's ActiveRecord:::Base default#to_s: http://pastie.caboo.se/74412 module ActionView module Helpers module UrlHelper def link_to_with_dry_logic(name, options = {}, html_options = nil) options = name if options.blank? url = options.is_a?(String) ? options : self.url_for(options) name ||= url name = name.last if name.is_a?(Array) name = html_escape(name.to_s) if name.respond_to?(:new_record?) link_to_without_dry_logic(name, options, html_options) end alias_method_chain :link_to, :dry_logic end end end
This paste will be private.
From the Design Piracy series on my blog: