ERROR: uninitialized constant PersonnelCoreController::Personnel

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    ERROR: uninitialized constant PersonnelCoreController::Personnel

    This is my controller personnel_core_ controller.rb
    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
    This is the form in new.html.erb
    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 -%>
    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 ...
    Attached Files
Working...