[rspec-users] RSpec makes me want to write better code

Ashley Moran ashley.moran at patchspace.co.uk
Fri Sep 26 12:47:25 EDT 2008

On 26 Sep 2008, at 17:28, Mark Wilden wrote:

> I think all of your comments make sense, but I did just want to call  
> out that "the Rails way" is not typically concerned with this sort  
> of integrity at the database level. It's handled in the model.

Ah ok, I wasn't sure if your comment was intended to be neutral.   
You're right, the Rails way is not concerned with DB-level integrity.

> Whether that's a good or bad thing can be debated, but it does  
> explain why STI's drawbacks don't outweigh its strengths (primarily  
> speed, compared to CTI, because of the lack of joins) in the minds  
> of true Rails believers.

I've avoided STI unless the models share all the attributes (and  
therefore you .  But it can be used acceptably at a Ruby level (be  
sure to spec what attributes your classes have if you're scared of  
pollution!) - it just means more hassle if you work in the DB directly.



More information about the rspec-users mailing list