Skip to content

Instantly share code, notes, and snippets.

@ddeaguiar
Created October 16, 2008 13:51
Show Gist options
  • Save ddeaguiar/17136 to your computer and use it in GitHub Desktop.
Save ddeaguiar/17136 to your computer and use it in GitHub Desktop.
%w(edit new formatted).each do |action|
module_eval <<-EOT, __FILE__, __LINE__
def #{action}_polymorphic_url(record_or_hash, options = {})
polymorphic_url(record_or_hash, options.merge(:action => "#{action}"))
end
def #{action}_polymorphic_path(record_or_hash, options = {})
polymorphic_url(record_or_hash, options.merge(:action => "#{action}", :routing_type => :path))
end
EOT
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment