0
這是我的代碼:如何在rails中使用link_to將多個事物放入單個鏈接?
<div class="column">
<div class="post-module">
<a href="https://www.livescience.com/59802-should-we-fear-
intelligent-robots.html" >
<div class="thumbnail">
<div class="date">
<div class="day">14</div>
<div class="month">Jul</div>
</div>
<img src="#"/>
</div>
<div class="post-content">
<div class="category">Robots</div>
<h1 class="title">Should We Fear The Rise of Intelligent
Robots? </h1>
<h2 class="sub_title"> Robots will unite. </h2>
<p class="description"></p>
</div>
</a>
</div>
</div>
我想在軌的代碼,但我只是在鐵軌一個初學者,我沒能找到的東西,可以幫我在這。我只知道rails中link_to的基本思想。
謝謝!還有一個問題。例如,如果鏈接是我製作的並且位於本地PC中,則我有一個名爲robotics.html.erb的頁面,我想鏈接到該頁面。我是否像robotics_path那樣鏈接它? –
是的,你可以提供任何網址。但要確保你有'robotics_path' helper:'rake routes'列出了在應用程序中定義的所有路徑(包括url和helpers)。 –
非常感謝! –