routing - rails: create a single table without id -


I just generated my first scam in the rail. Now, I do not want my table to have a field named "id" Instead I want to designate it as "uid" which would be an arbitrary string but I can not get my head about how to do this, especially with the management of routes I have set: Id => false and "uid" as primary key But the controller fails because it still tries to see it by ID

And, I know that the railways are all about conferences and everyone and I should not try "Railroad "But I really want to do this work in this way.

Update your code like this:

  create_table : Table_name ,: primary_key = & gt; : What is UID? T | ... and  

and your model should include this line:

  Class ModelName & lt; ActiveRecord :: Base set_primary_key: uid end  

will work with all common ID columns.

Model.find uid, id and etc. will not be found ...


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -