aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEileen M. Uchitelle <eileencodes@gmail.com>2015-09-25 12:24:51 -0400
committerEileen M. Uchitelle <eileencodes@gmail.com>2015-09-25 12:24:51 -0400
commit3c52b2000cbee716b5e449974c312c4fb552f64f (patch)
treee02dde6b1f847e825e7d088e5fcfd84a4e10988f
parent37661bfc810da7384ac6650d60be8669baa16813 (diff)
parent30769669e388104626bfc9bd8e9680c4fcee25cc (diff)
downloadrails-3c52b2000cbee716b5e449974c312c4fb552f64f.tar.gz
rails-3c52b2000cbee716b5e449974c312c4fb552f64f.tar.bz2
rails-3c52b2000cbee716b5e449974c312c4fb552f64f.zip
Merge pull request #21738 from cllns/remove-to_s-from-example
[Engines Guide] Remove to_s example, since it's outside the scope
-rw-r--r--guides/source/engines.md20
1 files changed, 1 insertions, 19 deletions
diff --git a/guides/source/engines.md b/guides/source/engines.md
index 6bbd68ff78..71844b7990 100644
--- a/guides/source/engines.md
+++ b/guides/source/engines.md
@@ -843,28 +843,10 @@ above the "Title" output inside `app/views/blorgh/articles/show.html.erb`:
```html+erb
<p>
<b>Author:</b>
- <%= @article.author %>
+ <%= @article.author.name %>
</p>
```
-By outputting `@article.author` using the `<%=` tag, the `to_s` method will be
-called on the object. By default, this will look quite ugly:
-
-```
-#<User:0x00000100ccb3b0>
-```
-
-This is undesirable. It would be much better to have the user's name there. To
-do this, add a `to_s` method to the `User` class within the application:
-
-```ruby
-def to_s
- name
-end
-```
-
-Now instead of the ugly Ruby object output, the author's name will be displayed.
-
#### Using a Controller Provided by the Application
Because Rails controllers generally share code for things like authentication