modify the name of the :id to :another_id in rails 3 -


well googled question couldn't find or it's not correct question..

the issue need modify primary_key name of database :id :another_id, in project need use pgrouting , contains several plsql functions , these functions uses primary-key name gid , instead of modify plsql functions better change id name, , thinking migration becouse thought it's rails way.

is possible, , how can ??

thanks in advance , sorry english.

edit

  create_table :pruebas, primary_key: :gid |t|     t.string :name     t.timestamps   end 

this trick, , active record generate , uses pk gid.

sorry if question not clear.. gracias por las respuestas.

to set primary key yourself, when create table, do:

create_table(:table_name, primary_key: 'gid') |t|    ... end 

and need define primary key name in model:

self.primary_key = 'gid' 

Comments

Popular posts from this blog

Glib GIOChannel -

jsp - java.sql.SQLException: [Microsoft][ODBC Microsoft Access > Driver] Too few parameters. Expected 1 -

delphi - When I encode/decode SMS PDU (GSM 7 Bit) user data, do I need prepend the UDH first? -