Mirv/pet_shop

Protect against nil when Pet_Categories or Locations are empty?

Opened this issue · 1 comments

Mirv commented

API/Views will fail if model or controller doesn't guard by inserting "Select Type" as default type to populate list.

This realistically falls under db initialization issue, but model is ultimately responsible for having a check on AR before passing to controller to then have API or template populate a list of the PetCategories or Locations are blank.

Mirv commented

Rails way calls for nil checks higher in the chain of hand offs & a rock solid set of form validations for information going to db (in addition to db).