this is a good exercise in custom flash messages, but checkout the default errors built into rails, you can avoid the serial logic branching like you're doing here. Example here: http://stackoverflow.com/questions/10531762/rendering-validation-errors-in-rails