我已经按照Hartl的教程制作了带有标记系统的ToDoList,并且还借助了word guide和video。
但是,当我尝试单击标签以滤除所有包含相同标签的微博时,我的html文件似乎出现了问题。我需要像这样的常规间隔(在实施标记系统之前,我必须显示示例主页,因为此功能确实是新功能,因此我试图从本教程中进行即兴创作)。
代替此,这是我当前的观点。
有人从错误消息日志中判断出如何解决问题并告诉我我实际上在做什么错的任何线索。由于渲染几乎随处可见,因此我很难使用Rails嵌入的这些html文件。而且,我并不真正了解该教程如何能够在单击标签后立即进行过滤。我不需要按照首页Feed的文本框。如果需要更多信息,请告诉我。
日志中涉及文件的HTML代码
micropost / index.html.erb
<h1>Filtered Micropost Page</h1>
<div class = "col-md-8 offset-2">
<% @microposts.each do |micropost| %>
<p><%= truncate(micropost.content, length: 50) %></p>
<p><small>Tags: <%= raw micropost.tags.map(&:name).map { |t| link_to t, tag_path(t) }.join(', ') %></small</p>
<span class="timestamp">
Posted <%= time_ago_in_words(micropost.created_at) %> ago.
<% if current_user?(micropost.user) %>
<%= link_to "Done", micropost_path(micropost), method: :delete, data: { confirm: "Keep up the good work!" } %>
<% end %>
</span>
<% end %>
</div>
Footer.html.erb
<footer class="footer">
<small>
A To-Do Manager</a>
by <a href="https://www.google.com"> Prashin</a> for
<a href = "http://www.google.com">Prashin</a>,
based on the rails tutorial guide by
<a href = "https://www.railstutorial.org/book">Michael Hartl</a>.
</small>
<nav>
<ul>
<li><%= link_to "About", about_path %></li>
<li><%= link_to "Contact", contact_path %></li>
</ul>
</nav>
<br>
<br><br>
<p align = center>
<%= link_to image_tag("AikenDueet.jpg", alt: "KenyuDueet"),
'www.google.com' %>
<br>I can do it!</p>
</footer>
header.html.erb
<header class="navbar navbar-fixed-top navbar-inverse">
<div class="container">
<%= link_to "To-Do App", root_path, id: "logo" %>
<nav>
<ul class="nav navbar-nav navbar-right">
<li><%= link_to "Home", root_path %></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Users <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><%= link_to "All Users", users_path %></li>
<li><%= link_to "Administrators", users_admin_path %></li>
</ul>
</li>
<% if logged_in? %>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
Account <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><%= link_to "#{current_user.name}", current_user %></li>
<li><%= link_to "Account Settings", edit_user_path(current_user) %></li>
<li class="divider"></li>
<li>
<%= link_to "Log out", logout_path, method: :delete %>
</li>
</ul>
</li>
<% else %>
<li><%= link_to "Log in", login_path %></li>
<% end %>
</ul>
</nav>
</div>
</header>
日志
Rendered microposts/index.html.erb within layouts/application (199.0ms)
Rendered layouts/_rails_default.html.erb (55.9ms)
Rendered layouts/_shim.html.erb (0.2ms)
Rendered layouts/_header.html.erb (0.7ms)
Rendered layouts/_footer.html.erb (0.8ms)
Completed 200 OK in 278ms (Views: 259.1ms | ActiveRecord: 11.4ms)