Active Record Validations In Rails: How They Work

Written by dragonastronauts | Published 2021/05/28
Tech Story Tags: ruby-on-rails | ruby-on-rails-validator | backend | beginners | active-record | orm | ruby | database

TLDR There are ways to bypass the callbacks and validations while still updating your database. Active record validations are a good place to start to prevent the funk. Sometimes you need to push the validations down to the database. Not every database constraint will provide value or even match perfectly with a model validation. The take away tip for where to start is go through your db/schema.rb and find columns that should either be null: false or have a default value and go write migrations for those.via the TL;DR App

no story

Written by dragonastronauts | A software company from Atlanta.
Published by HackerNoon on 2021/05/28