Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 Rails 4-页脚在index.html.erb和edit.html.erb上呈现方式不同_Ruby On Rails 4_Materialize - Fatal编程技术网

Ruby on rails 4 Rails 4-页脚在index.html.erb和edit.html.erb上呈现方式不同

Ruby on rails 4 Rails 4-页脚在index.html.erb和edit.html.erb上呈现方式不同,ruby-on-rails-4,materialize,Ruby On Rails 4,Materialize,如果渲染footer.html.erb,则在index.html.erb上会得到不同的结果 以及new.html.erb、edit.html.erb application.html.erb: <body> <%= render 'layouts/header' %> <div class="container"> <%= yield %> </div> <%= render 'layouts/footer' %>

如果渲染footer.html.erb,则在index.html.erb上会得到不同的结果

以及new.html.erb、edit.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 %>

禁止保存此属性:



“btn波浪效果波浪光”do%>

我看不出为什么页脚有时在container div之外,有时在container div内部。我使用

你能显示
新的.html.erb
视图吗?你能显示
表单.html.erb
吗?看起来您可能有一个
div
标记,它以partial的形式保持打开状态。