Re: Learn link_to RoR

30 views
Skip to first unread message
Message has been deleted

Yinka Ash a.k.a Netguru

unread,
Oct 8, 2016, 3:16:22 AM10/8/16
to Ruby on Rails: Talk
You need to specify path....

<td><%= link_to 'About', 'about_path' %></td> # or where your /about path points to

On Saturday, October 8, 2016 at 2:35:29 AM UTC-4, kinoe - wrote:
<p id="notice"><%= notice %></p>

<h1>Homes</h1>

<table>
  <thead>
    <tr>
      <th>Title</th>
      <th>Text</th>
      <th colspan="3"></th>
    </tr>
  </thead>

  <tbody>
    <% @homes.each do |home| %>
      <tr>
        <td><%= home.title %></td>
        <td><%= home.text %></td>
        <td><%= link_to 'Show', home %></td>
        <td><%= link_to 'About', 'about' %></td> #this line make by me
        <td><%= link_to 'Edit', edit_home_path(home) %></td>
        <td><%= link_to 'Destroy', home, method: :delete, data: { confirm: 'Are you sure?' } %></td>
      </tr>
    <% end %>
  </tbody>
</table>

<br>

<%= link_to 'New Post', new_home_path %>
then run error, so how make understand url this on RoR, home,edit_home_path(home) and etc, not error and make by me 'about error?'

Message has been deleted

Colin Law

unread,
Oct 9, 2016, 9:18:01 AM10/9/16
to Ruby on Rails: Talk
On 9 October 2016 at 14:14, kinoe - <kin...@gmail.com> wrote:
> Yinka Ash a.k.a
> Netguru
> about_path . i want to views/home/about.html.erb otherwise in my routes default make by rls g scaffold is resources :homes. whether i must make new?

I am afraid I do not understand your question, but have you read
carefully, and understood, the rails guide on routing?

Colin
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
Message has been deleted
0 new messages