ここからデータを送信したい
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 表示ページにリダイレクトする必要があります。どこが間違っていますか?