2016-06-23 5 views
0

Ruby-on-Rails 블로깅 웹 사이트를 구축 할 때 tutorial을 따르는 동안 예기치 않은 결과가 발생합니다. 지금까지의 프로젝트는 https://github.com/khpeek/jumpstart-blogger에 저장되어 있습니다.웹 사이트에서 예기치 않은 콘텐츠를 제거하십시오.

메인 페이지는 다음과 같이 보이는 "기사"페이지입니다 :

enter image description here

지금까지, "새 문서 만들기"버튼의 다소 호기심 위치를 제외하고 (그래서 좋은, 이전에는 기사 바로 아래에있었습니다).

<h1>All Articles</h1> 

<ul id="articles"> 
    <% @articles.each do |article| %> 
    <li> 
     <%= link_to article.title, article_path(article), class: 'article_title' %> 
    </li> 
    <% end %> 
</ul> 

<%= link_to "Create a New Article", new_article_path, class: "new_article" %> 

h1 제목은 웹에 나타나는 .html.erb 파일의 첫 번째 것은, 또한 제일 먼저 읽어 app/views/articles/index.html.erb이 적용됩니다 "모든 기사"의 모양, 페이지. 기사, 태그 및 주석으로 원하는 상자 외에

enter image description here

: 나는 기사의 링크를 클릭하면

그러나 "기사 루비 태그와 함께"나는 아래 페이지를 참조하십시오 말한다 두 개의 제출 버튼과 "< <"기사 목록으로 돌아 가기 "원하지도 기대하지도 않는 버튼이 있습니다.

내가 알기로이 페이지의 모양은이 파일의 첫 번째 줄은 h1 헤더 인

<h1><%= @article.title %></h1> 
<p> 
    Tags: 
    <% @article.tags.each do |tag| %> 
    <%= link_to tag.name, tag_path(tag) %> 
    <% end %> 
</p> 
<% if @article.image.exists? %> 
    <p><%= image_tag @article.image.url %></p> 
<% end %> 
<p><%= @article.body %></p> 
<h3>Comments (<%= @article.comments.size %>)</h3> 
<%= render partial: 'articles/comment', collection: @article.comments %> 
<%= render partial: 'comments/form' %> 
<%= link_to "<< Back to Articles List", articles_path %> 
<% if logged_in? %> 
    <%= link_to "delete", article_path(@article), method: :delete, data: {confirm: "Really delete the article?"} %> 
    <%= link_to "edit", edit_article_path(@article) %> 
<% end %> 

을 읽는, app/views/articles/show.html.erb에 의해, 지배되지만, '예상치 못한'내용은 전에 올 것 같다 그. 따라서이 콘텐츠를 제거하기 시작하는 위치를 확인하는 데 문제가 있습니다. 어떤 포인터?

답변

1

당신은 레이아웃 레일스의 개념을 다루고 있습니다. Read this.

어쨌든 app/views/layouts의 레이아웃 파일이있을 것입니다.

0

레이아웃 폴더에서 application.html.erb를 확인하십시오. 일부 조건에서 헤더에 렌더링 중입니다.

관련 문제