This is my controller personnel_core_ controller.rb
This is the form in new.html.erb
every time i run the page the error always appear in index and in personnel/new page like this images. I can't debbug the error here. .
I hope somebody here can help me, , any suggestions are appreciatted. . :) thank you...please ...
Code:
class PersonnelCoreController < ApplicationController
before_action :set_personnel, only: [:show, :edit, :update, :destroy]
def index
@personnel = Personnel.all
end
def new
@personnel = Personnel.new
end
def create
@personnel = Personnel.new(personnel_params)
respond_to do |format|
if @personnel.save
format.html { redirect_to @personnel, notice: 'Personnel Successfully Added.' }
format.json { render action: 'new', status: :created, location: @personnel }
else
format.html { render action: 'new' }
format.json { render json: @personnel.errors, status: :unprocessable_entity }
end
end
end
def show
end
def edit
end
def update
end
def destroy
end
private
# use callbacks to share common setup or constarints between actions
def set_personnel
@personnel = Personnel.find(params[:id])
end
# Never trust parameters from the scary intewrnet, only allow the white list through.
def personnel_params
params.require(:personnel).permit(:lastname, :firstname, :middlename, :extensionname)
end
end
Code:
<h1>PersonnelCore#newpersonnel</h1> <p>Find me in app/views/personnel_core/newpersonnel.html.erb</p> <%= form_for @personnel do |e| -%> <fieldset> Last Name: <%= e.text_field :lastname -%><br> First Name: <%= e.text_field :firstname -%><br> Middle Name: <%= e.text_field :middlename -%><br> Extension Name: <%= e.text_field :extensionname -%><br> <%= e.submit 'Save' -%> </fieldset> <% end -%>
I hope somebody here can help me, , any suggestions are appreciatted. . :) thank you...please ...