Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changing "link_to" to "button_to" because the "Goal" section refers to a

button not a link. and because a button is more appropriate for a state
change on the server.
  • Loading branch information...
commit ece7e090cca05882834ca54aac233d5bcfa88cfd 1 parent 20404d4
Gregory Tomei authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 lessons/14.yaml
6 lessons/14.yaml
@@ -14,7 +14,7 @@ steps: |
<td><%= topic.title %></td>
<td><%= topic.description %></td>
<td><%= pluralize(topic.votes.length, "vote") %></td>
- <td><%= link_to '+1', votes_path(:topic_id =>, :method => :post %></td>
+ <td><%= button_to '+1', votes_path(:topic_id =>, :method => :post %></td>
<td><%= link_to 'Show', topic %></td>
<td><%= link_to 'Edit', edit_topic_path(topic) %></td>
<td><%= link_to 'Destroy', topic, :confirm => 'Are you sure?', :method => :delete %></td>
@@ -43,10 +43,10 @@ explanation: |
First we added this line to `app/views/topics/index.html.erb`
<pre class="code">
- &lt;td>&lt;%= link_to '+1', votes_path(:topic_id =>, :method => :post %>&lt;/td>
+ &lt;td>&lt;%= button_to '+1', votes_path(:topic_id =>, :method => :post %>&lt;/td>
- * `link_to '+1'` creates an html link with the text '+1'
+ * `button_to '+1'` creates an html button with the value '+1'
* `votes_path(:topic_id =>` creates the right url for the action we want to invoke. In this case, we want to create a vote for the current topic.
* `votes_path(:topic_id => 42)` would output `/votes?topic_id=42`
* `:method => :post` ensures we do the create action of CRUD, not the read action.
Please sign in to comment.
Something went wrong with that request. Please try again.