如果我渲染我的footer.html.erb,我会在index.html.erb上获得不同的结果
application.html.erb:
<body>
<%= render 'layouts/header' %>
<div class="container">
<%= yield %>
</div>
<%= render 'layouts/footer' %>
</body>
new.html.erb
<div class="row">
<h3>Adding new property</h3>
<%= render 'form' %>
<div class="col s12">
<%= link_to 'Back', properties_path %>
</div>
</div>
_form.html.erb
<%= form_for(@property, html: { multipart: true }) do |f| %>
<% if @property.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@property.errors.count, "error") %> prohibited this property from being saved:</h2>
<ul>
<% @property.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
</div>
<% end %>
<form class="col s12">
<div class="row">
<div class="input-field col s4">
<%= f.label :name %><br>
<%= f.text_field :name %>
</div>
<div class="input-field col s4">
<%= f.label "Rent or Sell" %><br>
<%= f.select :rent, ['Rent', 'Sell']%>
</div>
<div class="input-field col s4">
<%= f.label "Price in €" %><br>
<%= f.text_field :price %>
</div>
</div>
<div class="row">
<div class="input-field cols s4"></div>
<div class="input-field col s4">
<%= f.submit "Submit", :class => "btn waves-effect waves-light" do%>
<% end %>
</div>
<div class="input-field cols s4"></div>
</div>
</form>
<% end %>
我看不出为什么有时候在容器div之外的页脚,有时在里面。我使用materializecss.com