Thanks @rafaelfranca - It is important to notice that using HTTP verbs to automatically routing queries is also dangerous and have the same implications that you mention, rails resolves that problem setting a session after a write to the primary database to ensure a subsequent GET or HEAD request is send to the primary database within a
delay window (2 seconds by default).
The difference between the current and the proposed approach is that in some cases GET request also perform some write operations forcing devs to write this kind of blocks around all these operations:
@blog = Blog.find(params[:id])
ActiveRecord::Base.connected_to(role: :writing) do
The proposed approach would avoid these blocks as the automatically switching is determinated depending the database operation, an approach to avoid reading from the replica database before the change is reflected would be also possible to implement using this approach. Although I’m sure this is not something easy to implement and the current rails 6 also works properly, thanks again to let me know that this is not in the current plans.
Finally and if someone is interested looks like Makara has already implemented the proposed approach (GitHub - taskrabbit/makara: A Read-Write Proxy for Connections; Also provides an ActiveRecord adapter.).