Testing ideas

Doing more Ruby on Rails today.

For ensuring data is good …

Anyone ever try using a scope to drop bad results and streamline view presentation?

Then just show the malformed entries on a different view where it doesn’t bork everything up?

Example I hit …

- if pet.user_detail 
  %td= pet.user_detail.name 
- else 
  %td= "Crap"

Revealed I had a single bad piece of data in my test results.

I’ve been playing around with rescue strategies etc for a year when something is missing.

Something like this guy does, though I used another’s idea last year … Link

Having struggled with this several times, I am considering the viability of a scope or series of them that presents only data that is valid & present.  Something tells me there is probably a better way in code to do this, but the “If you absolutely & completely must be sure nothing should get to the view unless the record is good…” part of me is going “HRRRRMM”.

From time as a database admin, I would solve this issue in the DB, as a well formed one would have checks against bad data, but from a coders perspective there are more tools available and the database won’t always know what constitutes good data.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s