Renaming keys in a Hash, sanitizing input for a LIKE query, and toggling attributes in Rails.
How to add model validation for a column using a PostgreSQL enum type in Rails 7.1.
Learn how to strike a balance between flexibility and data integrity with a partial index and validations.
Running a separate query to count how many records are associated with another record is inefficient. Using a counter cache can save the day!
Learn how to improve the interface of your existing Active Record Models with this underutilized API.
Learn about an unexpected limitation with this API and how to combat it universally.
How do you even save a “duration”, let alone query for records by that value? It’s actually easier than you think.
Search through user-provided HTML content with PostgreSQL and Active Record.
Extract common clauses when using Active Record’s .or method.