3 ms·
> i don't have to look at the database to know which properties a model has I just pop open db/schema.rb and then search for where the users table schema is d
by snprbob86 15y ago
> i don't have to look at the database to know which properties a model has
I just pop open db/schema.rb and then search for where the users table schema is described. This .rb file is automatically generated. In production systems, I actually configure it to use db/schema.sql which stores the SQL schema instead of the Ruby schema, since my production database has indexes that Rail's migrations can't describe directly.
Or even more directly:
psql -c '\d users'
Which I typically run from vim:
:!psql -c '\d users'
And that just prints out the description of the table for me.
- fernandotakai 15y agoI don't know, but i think that looking at models/yourmodel.py is easier. But well, this is me (and also, i came from a hibernate/spring background). And for 'newbies', it's more intuitive to look for a class model than to look for sql schema.