From a5d588875f22af852324f57aedef00b1aa345c7b Mon Sep 17 00:00:00 2001 From: Kuldeep Aggarwal Date: Fri, 15 Nov 2013 20:05:17 +0530 Subject: added one test case and example for ActiveRecord::Base.to_param method --- activerecord/lib/active_record/integration.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'activerecord/lib/active_record/integration.rb') diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb index 951db5b756..f8aa0c55db 100644 --- a/activerecord/lib/active_record/integration.rb +++ b/activerecord/lib/active_record/integration.rb @@ -81,6 +81,10 @@ module ActiveRecord # user.id # => 123 # user_path(user) # => "/users/123-fancy-pants" # + # user = User.find_by(name: 'David HeinemeierHansson') + # user.id # => 125 + # user_path(user) # => "/users/125-david" + # # Because the generated param begins with the record's +id+, it is # suitable for passing to +find+. In a controller, for example: # -- cgit v1.2.3