I have an application (Ruby on Rails v6) which is configured to establish connection with two databases. Application can read and write to the primary database whereas it can only read from secondary database.
I have setup an application as well: https://github.com/dineshpanda/blog_app
I get the following error while running rails test test/controllers/blogs_controller_test.rb:
BlogsControllerTest#test_should_get_index:
ActiveRecord::ReadOnlyError: Write query attempted while in readonly mode: UPDATE "users" SET "last_login" = $1, "updated_at" = $2 WHERE "users"."id" = $3
app/controllers/application_controller.rb:8:in `find_user'
test/controllers/blogs_controller_test.rb:10:in `block in <class:BlogsControllerTest>'
It makes sense that I get the error since I am trying to update users record while in read mode.
Question: Can I only specify writing role for all kind of reading and writing operations. I do not want to support both writing and reading role for primary database.
Looking forward to your answers.