active record table building and validation