diff options
author | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2013-11-15 20:05:17 +0530 |
---|---|---|
committer | Kuldeep Aggarwal <kd.engineer@yahoo.co.in> | 2013-11-15 20:05:17 +0530 |
commit | a5d588875f22af852324f57aedef00b1aa345c7b (patch) | |
tree | a899a583edefc0b0a3520d4f3730b061e93be167 /activerecord/lib | |
parent | 81475534ed9e2e1b7bade50f1e1099975e385a46 (diff) | |
download | rails-a5d588875f22af852324f57aedef00b1aa345c7b.tar.gz rails-a5d588875f22af852324f57aedef00b1aa345c7b.tar.bz2 rails-a5d588875f22af852324f57aedef00b1aa345c7b.zip |
added one test case and example for ActiveRecord::Base.to_param method
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/integration.rb | 4 |
1 files changed, 4 insertions, 0 deletions
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: # |