3-11 link to 等 解说
erb app/views/topics/index.html.erb
<td><%= topic.description %></td>
这一行用了 .description
来取得内文,然后直接输出。
erb app/views/topics/index.html.erb
<th>Description</th>
<th>
指的是表格表头(table header),在 <th>
和 </th>
之间的字会变成表头(粗体)。我们把它删掉,因为我们要拿掉内文栏位,不然的话栏位对不起来会很奇怪。
erb app/views/topics/index.html.erb
<td><%= link_to topic.title, topic %></td>
这里来了一个新的 link_to
(制作超连结)的用法。这次制作的超连结使用了 topic 的标题(title),连到 topics#show 的页面。
Updated less than a minute ago