Articles in this series
You have an array of hashes and want to check if all elements are satisfying a condition.
You might want to do this in Ruby:
You have a column in your table that is used as an array , like this:
t.string 'ids', array: true
And you want to select all records that...
Let's say that you have two array of hashes:
a = [
How to create a raw SQL to update in Rails different values for each record in one single query · Context
You want to update the same column for multiple...
Examples of creating an enum type, renaming a value, deleting a value · Rails 7 introduced a new way to create enums in PostgreSQL, by adding create_enum...
How to get the class name
To get the class name:
def call = puts self.class.name
User.new.call #=> User
This will work even if the...