Missed commit. References #10395.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8344 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jeremy Kemper
2007-12-09 23:02:50 +00:00
parent 2d2fd67b51
commit 62ddeaf052

View File

@@ -0,0 +1,14 @@
class Object
# Alias of <tt>to_s</tt>.
def to_param
to_s
end
# Converts an object into a string suitable for use as a URL query string, using the given <tt>key</tt> as the
# param name.
#
# Note: This method is defined as a default implementation for all Objects for Hash#to_query to work.
def to_query(key)
"#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}"
end
end