Posts by leo Castro • 11 points
2 posts
-
0
votes1
answer124
viewsQ: Return the name instead of the ID in a Rails relationship
I have two related tables in Rails, pessoa and cidade. On the table pessoa have the field cidade_id. How to do, for example, p = Pessoa.find(1) and in place of p.cidade_id already return the name of…
-
1
votes1
answer330
viewsQ: Script to change table names in the Postgresql database
I have this script: SELECT n.nspname AS schema_name, c.relname AS table_name, c.reltuples::int AS num_reg FROM pg_class c LEFT JOIN pg_namespace n ON n.oid = c.relnamespace LEFT JOIN pg_tablespace t…