8 ms·
There are always pros/cons to any approach one can as easily argue that without AR your code is less DRY as you need to keep your models in sync with your DB sc
by qaq 10y ago
There are always pros/cons to any approach one can as easily argue that without AR your code is less DRY as you need to keep your models in sync with your DB schema manually. (I am not a fan of AR either)
- majewsky 10y agoYou could easily build a unit test that compares the set of exposed properties of your model class with the columns of the table in your test DB.
- qaq 10y agoThat's not really a unit test and not really a good idea to do it this way. You'll still have to keep model in sync with schema you'll just know when they diverge.
- eropple 10y agoIf that's a concern, invert it and create tables off of your object model. It's Ruby, that's trivial.