结束还是结束?期待keyword_end

时间:2016-11-29 09:05:04

标签: ruby-on-rails wicked-gem

我正在尝试为我们计划使用的系统构建基于Wicked的多页面表单。 但是,在我添加第三个表单页面后,用于填充数据库中的第二个表格,我得到下面列出的错误。 我已经尝试添加和删除<%end%>标签最后但没有成功。谁能帮助我?

  

/home/supervisor/Rubyrails/Werkvergunning/app/views/enquirys/steps/measurements.html.erb:45:   语法错误,意外的keyword_ensure,期待keyword_end   /home/supervisor/Rubyrails/Werkvergunning/app/views/enquirys/steps/measurements.html.erb:47:   语法错误,意外的输入结束,期待keyword_end

     

Rails.root:/ home / supervisor / Rubyrails / Werkvergunning应用程序   跟踪|框架跟踪|完整跟踪

     

app / views / enquirys / steps / measurements.html.erb:45:语法错误,   意外的keyword_ensure,期待keyword_end   app / views / enquirys / steps / measurements.html.erb:47:语法错误,   意外的输入结束,期待keyword_end   app / controllers / enquirys / steps_controller.rb:7:在`show'

measurements.erb.html:

<%= form_for @enquiry, method: :put, url: wizard_path do |f| %>
  <% if f.object.errors.any? %>
    <div class="error_messages">
      <% f.object.errors.full_messages.each do |error| %>
        <p><%= error %></p>
      <% end %>
    </div>
  <% end %>

  <fieldset>
    <legend>Maatregelen</legend>
       <%= f.fields_for :enquiry_measures do |enquiry_measures| %>
                                <%= enquiry_measures.fields_for :measure do |measures| %>
    <div>
      <%= f.label :Maatregel %>
      <br />
      <%= collection_select(:measure, :enquiry_id, Enquiry.all, :id, :measurement) %>
     <%# http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#method-i-collection_select -%>
    </div>
     <div>
      <%= f.label :Gereed %>
      <br />
      <%= enquiry_measures.text_field :done %>
    </div>

    <div>
      <%= f.label :Verantwoordelijke %>
      <br />
      <%= enquiry_measures.text_field :responsible %>
    </div>

    <div>
      <%= f.label :Benodigd %>
      <br />
      <%= enquiry_measures.text_field :needed %>
    </div>       

    <div>
      <%= f.submit 'Next Step' %>
    </div>
  </fieldset>
<% end %>

和stepscontroller:

class Enquirys::StepsController < ApplicationController
include Wicked::Wizard
  steps *Enquiry.form_steps

  def show
    @enquiry = Enquiry.find(params[:enquiry_id])
    render_wizard
  end

  def update
    @enquiry = Enquiry.find(params[:enquiry_id])
    @enquiry.update(enquiry_params(step))
    render_wizard @enquiry
  end

  private

  def enquiry_params(step)
    permitted_attributes = case step
                           when "basic"
                             [:Reference, :Location, :Description]
                           when "when"
                             [:Amount, :Date]
                           when "measurements"
                            [:responsible]
                           end

    params.require(:enquiry).permit(permitted_attributes).merge(form_step: step)
  end

end

1 个答案:

答案 0 :(得分:0)

在关闭fieldset之前添加2结尾

<link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.2/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.0.2/dist/leaflet.js"></script>