V
V
Vyacheslav Alekseev2015-10-06 17:01:42
Ruby on Rails
Vyacheslav Alekseev, 2015-10-06 17:01:42

What is the correct way to organize validation in Rails?

Good afternoon!
I am developing an application on Ruby on Rails, I ran into a problem: how to correctly check the field before executing the method?
For example, there is an Invitation model (invitation) and it has an accept method . Before calling the accept method , it would be necessary to check the data that the user sends against the data in the database. In a bad result, terminate the method and return an error that the controller can render.
It was possible to nagovnocode, but I want to do it in rails-way

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question