# first option should specify the flash type. # defaults to :error if not given def flash_from_errors(object, *options) type = ([:notice, :error, :alert, :success, :news] & options)[0] || :error msg = object.errors.full_messages.join(", and ").downcase.capitalize options.include?(:now) ? flash.now[type] = msg : flash[type] = msg end