Skip to content

Commit

Permalink
Missed commit. References #10395.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8344 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
jeremy committed Dec 9, 2007
1 parent 2d2fd67 commit 62ddeaf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions activesupport/lib/active_support/core_ext/object/conversions.rb
@@ -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

0 comments on commit 62ddeaf

Please sign in to comment.