Select Page

Active Record Tutorials

Validating Email Addresses in Ruby on Rails Models

Validating Email Addresses in Ruby on Rails Models

Validating email addresses is a common requirement when building web applications. In Ruby on Rails, you can use model validation to ensure that an email address is in the correct format before saving it to the database. In this post, we'll cover how to validate email...

Render JSON: Rails Models & Associations Responses

Render JSON: Rails Models & Associations Responses

When building a web application with Ruby on Rails, you may need to render JSON responses of your models and their associations. JSON (JavaScript Object Notation) is a lightweight data interchange format that is easy for humans to read and write, and easy for machines...

Rails: Understanding save vs. save! Difference

Rails: Understanding save vs. save! Difference

When working with Ruby on Rails, you may find yourself needing to save a model instance to the database. Two methods used to accomplish this task are save and save!. While both methods save a record to the database, they behave differently when an error occurs during...

A Guide to Clearing All Records in a Rails Database

A Guide to Clearing All Records in a Rails Database

If you're working on a Ruby on Rails application, you may come across situations where you need to clear all records in the database. This can be helpful during testing, when you want to start with a clean slate, or during development when you want to remove all data...

Deleting Associated Records in Ruby on Rails

Deleting Associated Records in Ruby on Rails

Ruby on Rails provides a lot of powerful tools for working with associations between models. One common use case is to delete associated records when a parent record is destroyed. In this blog post, we'll explore how to delete a guest record when a reservation record...

Upserting Models in Rails: Efficient Data Management

Upserting Models in Rails: Efficient Data Management

Ruby on Rails (RoR) is a popular web application framework that allows developers to build efficient and scalable web applications. One of the key features of RoR is its ability to manage data using an object-relational mapping (ORM) layer, which maps database tables...