By default, foreign key constraints in PostgreSQL are checked after each statement. This works for most use cases but becomes a major limitation when creating related records before the parent record is inserted into the database.
Starting with Rails 7, we can add caching? helper to check whether the current code path is being cached and uncacheable! helper to avoid fragment caching.
Sometimes, it is better not to use any external state management tool unless our application is that complex. We can avoid complexities involved in state management using some of the inherent ways.
In complex applications, client apps have to store and manage a large amount of nested data, and if the data is not normalized, it can be incredibly time-consuming for a program to lookup nested data which could become a performance concern.