Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Warn yourself of problems with your ActiveRecord tables.
Ruby
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
test
.gitignore
CHANGELOG
Gemfile
README.rdoc
Rakefile
table_warnings.gemspec

README.rdoc

table_warnings

NOTE: only for activerecord right now because it uses count(:conditions => [...])

How to define warning signs

class AutomobileMake < ActiveRecord::Base
  warn_if_blanks :name
  warn_if_blanks :fuel_efficiency
  warn_unless_size :hundreds
end

How to see warnings for the table

?> AutomobileMake.table_warnings
=> [ "Table is not of expected size" ]

Defense

  • This is not the same as validations, because those interfere with the saving of individual records

Self-criticism

  • Maybe this should work work on any class that defines .all

Copyright 2011 Seamus Abshere

Something went wrong with that request. Please try again.