4 ms·
I have to say that i prefer the Django/sqlalchemy way. I know that i'm probably duplicating code, but with this way, i don't have to look at the database to kn
by fernandotakai 15y ago
I have to say that i prefer the Django/sqlalchemy way.
I know that i'm probably duplicating code, but with this way, i don't have to look at the database to know which properties a model has, i just have to go to the .py file.
Also, i can use migrations as well to make sure the database is with the right version.
- 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.