Ruby on Rails
Sunday, October 9, 2016
1.rails g scaffold home
2.in index.html.erb
<<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 not scaffold
<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 error 'about' , how make url for show about.html.erb.is this:
get '/home' => 'home#about' #but this same with index
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/700a047d-3737-4d03-8dde-1cd35e0d9c4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment