From 357578256fb55e32ae87c6fbf22a1c19f59ce264 Mon Sep 17 00:00:00 2001 From: Ryan Bigg Date: Tue, 5 Apr 2011 21:22:10 +1000 Subject: Correct documentation on url_for. It doesn't call to_s, but rather to_param --- actionpack/lib/action_view/helpers/url_helper.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 2cd2dca711..6496397c31 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -81,9 +81,12 @@ module ActionView # # => /workshops # # <%= url_for(@workshop) %> - # # calls @workshop.to_s + # # calls @workshop.to_param which by default returns the id # # => /workshops/5 # + # # to_param can be re-defined in a model to provide different URL names: + # # => /workshops/1-workshop-name + # # <%= url_for("http://www.example.com") %> # # => http://www.example.com # -- cgit v1.2.3