Get validation error messages without saving

If I understand your question correctly you want to get the errors without saving the model?

That is exactly what is happening. @post.valid?

will return true or false depending on whether there are any errors. If there are errors. they will be added to @post.errorshash.

In the situation where you want to save just call @post.save
It will return true if successfully saved or false if errors are present while populating @post.errors in the process

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)