1

我的申请中有这样的表格

  <%= form_for(@order) do |f| %>
<% if @order.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@order.errors.count, "error") %> prohibited this category from being saved:</h2>

      <ul>
      <% @order.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

      <div class="col-md-12">
       <div id="customs-form">
           <span class="badge">1</span>
          <%= f.label "Select your model location*" %>
          <%= f.collection_select :location_id, Location.all, :id, :formatted_display, { prompt: true }, :required => true,  :class => 'chosen-select order_form' %>

          <span class="badge">2</span>
          <%= f.label "Select Your model" %>
          <%= f.select :performer_id, grouped_options_for_select(Location.order(:name).map{ |group| [group.name, group.performers.map{ |performer| [performer.first_name, performer.id, {'data-whitelabel_amount'=>performer.white_label.w_markup, 'data-thumb' => performer.profile_thumb_url,'data-id'=>performer.white_label.id, 'data-admin' => performer.white_label.markup.price }] } ] }), { prompt: true},  required: true, class: 'chosen-select order_form' %>

          <span class="badge">3</span>
          <%= f.label "SELECT YOUR CATEGORY" %>
          <%= f.select :clip_category_id, grouped_options_for_select(Performer.order(:first_name).map{ |group| [group.first_name, group.clip_category_performers.map{ |c| [c.clip_category.name, c.clip_category.id, {'data-amount'=>c.amount}] } ] }), { prompt: true},  required: true, class: 'chosen-select order_form' %>

          <span class="badge">4</span>
          <%= f.label "SELECT THE DURATION" %>
          <%= f.select :duration_id, grouped_options_for_select(Performer.order(:first_name).map{ |group| [group.first_name, group.duration_performers.map{ |c| [c.duration.time, c.duration.id, {'data-amount'=>c.amount}] } ] }),{ prompt: true},  required: true, class: 'chosen-select order_form' %>

          <span class="badge">5</span>
          <%= f.label "SELECT THE QUALITY" %>
          <%= f.select :quality_id, grouped_options_for_select(Performer.order(:first_name).map{ |group| [group.first_name, group.quality_performers.map{ |c| [c.quality.name , c.quality.id, {'data-amount'=>c.amount}] } ] }), { prompt: true},  required: true,  class: 'chosen-select order_form' %>

          <span class="badge">6</span>
          <%= f.label "SELECT DELIVERY TIME" %>

          <%= f.select :delivery_time_id, grouped_options_for_select(Performer.order(:first_name).map{ |group| [group.first_name, group.delivery_time_performers.map{ |c| [c.delivery_time.duration, c.delivery_time.id, {'data-amount'=>c.amount}] } ] }), { prompt: true},  required: true,  class: 'chosen-select order_form' %>
        <span class="badge">7</span>

        <%= f.label "Write your description"%>

             <% if session[:from_site] %>
     <%= f.hidden_field :affiliate_id, :value=>@prev_website_id%>
     <%end %>
        <%= f.text_area :description, :rows => 4, :cols => 60, maxlength: 999, :class => "order_desc order_form form-control" %>
        <span id="remainingC"><p class="help-block">Content limited to 999 characters, remaining: 999</p></span>
        <%= f.hidden_field :total, value: "", id: "order_total"%>
        <% if user_signed_in? %>
        <%= f.hidden_field :email, :value => current_user.email%>
        <% end %>
        <div class="actions" >
          <h4 class="alert1"><p class ="help-block">*Please buy credits before you order as customer</p></h4>
          <%= f.button :"ORDER NOW", :class => "btn btn-lg btn-marketing" %>
        </div>

    </div>
     <!-- <div class="actions" onclick="check()">-->
  <% end %>
</div>

这是为了在我的应用程序中创建一个订单。用户在执行此操作之前必须先登录。因此,如果他在没有登录页面的情况下重定向,则同一页面中的所有选择都将丢失。我尝试使用会话变量,但读到它们不应该在视图中使用。那我该如何实现呢?

4

0 回答 0