For my rails app, I used the scaffolding method to create the tables and the views and wanted to modify the employees model with setting an own primary key (with 'set_primary_key') in my model. I wanted to use the column "personel_number" as my primary key.
But of course it's not working that well. I already deleted the rails-set id. If I create a new employee and want to submit it, rails routes wrong, it still routes to [...]/employees/1 instead of [...]/employees/5000 (this is the personel_number).
First I thought, this problem might be simply solved by changing @employee = Employee.find(params[:id])
into @employee = Employee.find(params[:personel_number])
but this is not working:
ActiveRecord::RecordNotFound in EmployeesController#show
Couldn't find Employee without an ID
how can I solve this problem?