条件新增/修改 条件新增/修改 manager

<% if @requirement.errors.any? %>

有<%= @requirement.errors.count %>个错误:

<% errors = "" %> <% @requirement.errors.messages.values.each_with_index { |message, index| errors = errors + "#{index+1}.#{message.join(";")}; " } %> <%= errors %>
<% end %>

条件新增/修改

<%= form_for(@requirement, url: (@requirement.id ? report_requirement_path(@report, @requirement) : report_requirements_path(@report)), :html => {:class => "form-horizontal", :id => "obj_form"}) do |f| %>
<%= f.text_field :name, class: "form-control", placeholder: "name" %>
<%= f.text_field :sql_key, class: "form-control", placeholder: "sql_key" %>
<%= f.text_field :sql_default, class: "form-control", placeholder: "当用户输入空值时,要替换的sql。" %>当用户输入空值时,要替换的sql。
<%= f.text_field :sql_replace, class: "form-control", placeholder: "当用户输入空值时,sql替换成。" %>当用户输入空值时,sql替换成。
<%= f.select :form_type, options_for_select(Requirement.form_type_options, @requirement.form_type), {}, class: "form-control" %>
<%= f.select :sql_type, options_for_select(Requirement.sql_type_options, @requirement.sql_type), {}, class: "form-control" %>
<%= f.text_area :sql_str, class: "form-control", placeholder: "sql_str" %>
<% end %>
<%= content_for :js_bottom do %> <% end %>