提交 simple_form 后,我在显示视图中看到一个空白页面

After submitting simple_form i get a blank page in show view

我创建了一个简单的表单,用户单击三个项目并按提交,然后正在发送一封电子邮件,所有这些都有效。但是,当我测试它并检查显示页面时,它没有显示用户选择的任何输入的详细信息,只有空白 page.i 没有收到任何错误。

控制器

class PositionsController < ApplicationController

  def new
    @position = Position.new
  end

  def show
    @position = Position.find(params[:id])
  end

  def create
    @position = Position.new(position_params)
    if @position.save
      PositionMailer.general_message(@position).deliver
    else
      render :new
    end
  end

  private def position_params
    params.permit(:date, :time, :activity)
  end
end

查看

<div class="form">
  <%= simple_form_for @position  do |f| %>
    <div class= "trip">
        <div class="trip-text">
          Trip number
        </div>
        <div class="trip-field">
          <%= f.input :tripnumber, label: false, placeholder: 'enter here' %>
        </div>
    </div>
    <div class= "activity">
      <div class="activity-text">
        Activity
      </div>
      <div class="activity-field">
        <%= f.input :activity, label: false, collection: [['Sailing to loadport, expected arrival', 'Sailing to loadport, expected arrival'], ['Sailing to discharge port, expected arrival', 'Sailing to discharge port, expected arrival'],
          ['Loading untill', 'Loading untill'], ['Discharging untill', 'Discharging untill'], ['Waiting for loading, expect to start', 'Waiting for loading, expect to start'], ['Waiting for discharge, expect to start', 'Waiting for discharge, expect to start']] %>
       </div>
    </div>
    <div class="date">
      <div class="date-text">
        Date
      </div>
      <div class="date-field">
        <%= f.date_field :date, class: 'form-control' %>
      </div>
    </div>
    <div class="time">
      <div class="time-text">
        Time
      </div>
      <div class="time-field">
        <%= f.time_field :time, value: "%H:%M", min: 'hh:mm:ss', max: 'hh:mm:ss' %>
      </div>
    </div>
  <%= f.submit "Send update", class: "submit"%>
</div>

因为我没有错误并且一切正常,除了我没有用户的输入我不知道去哪里看,我在论坛和 google 上查看但没有成功

create操作中,添加redirect_to @position

if @position.save
  PositionMailer.general_message(@position).deliver
  redirect_to @position
else
  render :new
end

希望对您有所帮助!