aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorSean Collins <sean@cllns.com>2015-09-24 10:15:52 -0600
committerSean Collins <sean@cllns.com>2015-09-24 10:15:52 -0600
commit30769669e388104626bfc9bd8e9680c4fcee25cc (patch)
tree2be27683eddf39cd8eaa4b8f578488aca1a3dbd0 /guides
parent4cf449df9136117f2f0acf9730bf754f889f4dfa (diff)
downloadrails-30769669e388104626bfc9bd8e9680c4fcee25cc.tar.gz
rails-30769669e388104626bfc9bd8e9680c4fcee25cc.tar.bz2
rails-30769669e388104626bfc9bd8e9680c4fcee25cc.zip
Remove to_s example
It's outside the scope of the Engines guide [skip ci]
Diffstat (limited to 'guides')
-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 a3cff2a807..54cee03df9 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