aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activerecord/lib/active_record/integration.rb7
-rw-r--r--activerecord/test/cases/integration_test.rb6
-rw-r--r--guides/source/command_line.md2
3 files changed, 13 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/integration.rb b/activerecord/lib/active_record/integration.rb
index 951db5b756..27576b1e61 100644
--- a/activerecord/lib/active_record/integration.rb
+++ b/activerecord/lib/active_record/integration.rb
@@ -81,6 +81,13 @@ module ActiveRecord
# user.id # => 123
# user_path(user) # => "/users/123-fancy-pants"
#
+ # Values longer than 20 characters will be truncated. The value
+ # is truncated word by word.
+ #
+ # 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:
#
diff --git a/activerecord/test/cases/integration_test.rb b/activerecord/test/cases/integration_test.rb
index 8097f6e36e..07ffcef875 100644
--- a/activerecord/test/cases/integration_test.rb
+++ b/activerecord/test/cases/integration_test.rb
@@ -34,6 +34,12 @@ class IntegrationTest < ActiveRecord::TestCase
assert_equal '4-a-a-a-a-a-a-a-a-a', firm.to_param
end
+ def test_to_param_class_method_truncates_edge_case
+ firm = Firm.find(4)
+ firm.name = 'David HeinemeierHansson'
+ assert_equal '4-david', firm.to_param
+ end
+
def test_to_param_class_method_squishes
firm = Firm.find(4)
firm.name = "ab \n" * 100
diff --git a/guides/source/command_line.md b/guides/source/command_line.md
index 1b0b93c3bc..3b80faec7f 100644
--- a/guides/source/command_line.md
+++ b/guides/source/command_line.md
@@ -56,8 +56,6 @@ Rails will set you up with what seems like a huge amount of stuff for such a tin
The `rails server` command launches a small web server named WEBrick which comes bundled with Ruby. You'll use this any time you want to access your application through a web browser.
-INFO: WEBrick isn't your only option for serving Rails. We'll get to that [later](#server-with-different-backends).
-
With no further work, `rails server` will run our new shiny Rails app:
```bash