1

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?

Kirinriki
  • 855
  • 4
  • 12
  • 18
  • 1
    You need to show your code for the models, the form that you are submitting and a stack trace from of the error from your log file including any params passed into the offending controller action. With this information I'm sure someone will be able to help very quickly. There just is not enough information to go on right now – jamesc Aug 07 '11 at 16:33

0 Answers0