You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using fresh_connection 2.4.4 and when trying to create a record that has a uniqueness validation, the query checks for existence of the record against master and not replica. Is there any way to force the query to go to replica? Thanks
Running Rails 4.2.7
Ruby 2.3.4
The text was updated successfully, but these errors were encountered:
The validation query must be executed on master DB.
Because of you can't validate when replication delay occurs.
example:
classUservalidates:email,uniqueness: trueendUser.create!(email: "tsukasa.oishi@gmail.com")# If replication delay is occuring, the following query will succeed!User.create!(email: "tsukasa.oishi@gmail.com")
@tsukasaoishi thanks for the response! I see, will move the constraint to the database and remove the AR validation to avoid this query going to master.
Using fresh_connection 2.4.4 and when trying to create a record that has a uniqueness validation, the query checks for existence of the record against master and not replica. Is there any way to force the query to go to replica? Thanks
Running Rails 4.2.7
Ruby 2.3.4
The text was updated successfully, but these errors were encountered: