ABSTRACT

Ruby on Rails is a flexible and dynamic language. It is considered flexible mostly in terms of syntax. Nevertheless, fields markup can easily become tedious to fill and maintain because of the need to regulate field naming and other multiple attributes. Rails does it through view helpers for generating fields and forms markup. However, since these helpers have different use cases, it is important to know the differences between the helper methods before utilizing them. Model-level validations would be the best way, in this case, to ensure that only valid data is saved into our database. They are database agnostic, cannot be bypassed by end-users, and are simple to test and maintain. Anyway, Rails provides additional built-in helpers for common needs. The validation processes by performing an SQL query into the model's table, looking for an existing record with the same value in that attribute.