在这里我想提交数据
class Employee::GeneralInformationsController < ApplicationController
to class EmployeeRegistersController < ApplicationController
employee_register.rb 模型
在这里,我想从 Employee::GeneralInformationsController 中的 EmployeeRegister 模型中获取所有数据,我的 Employee::GeneralInformation 控制器是这样的
class Employee::GeneralInformationsController < ApplicationController
def index
@employee_general_informations = EmployeeRegister.all
end
def show
@employee_general_information = EmployeeRegister.find(params[:id])
end
def new
@employee_general_information = EmployeeRegister.new
end
def edit
@employee_general_information = EmployeeRegister.find(params[:id])
end
def create
@employee_general_information = EmployeeRegister.new(params[:employee_general_information])
respond_to do |format|
if @employee_general_information.save
format.html { redirect_to @employee_general_information, notice: 'General information was successfully updated.' }
format.json { render json: @employee_general_information, status: :created, location: @employee_general_information }
else
format.html { render action: "new" }
format.json { render json: @employee_general_information.errors, status: :unprocessable_entity }
end
end
end
def update
@employee_general_information = EmployeeRegister.find(params[:id])
respond_to do |format|
if @employee_general_information.update_attributes(params[:employee_general_information])
format.html { redirect_to @employee_general_information, notice: 'General information was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @employee_general_information.errors, status: :unprocessable_entity }
end
end
end
def destroy
@employee_general_information = EmployeeRegister.find(params[:id])
@employee_general_information.destroy
respond_to do |format|
format.html { redirect_to employee_general_informations_url }
format.json { head :no_content }
end
end
end
我的表格是这样的
<%= simple_form_for(@employee_general_information) do |f| %>
<%= f.error_notification %>
<div class="form-inputs">
<%= f.input :first_name %>
</div>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
问题是数据从 Employee::GeneralInformationsController 保存到 EmployeeRegisters 模型后,它重定向到员工注册显示页面。但它应该重定向到 Employee::GeneralInformations 显示页面。我哪里错了?