-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support AR::Relation (add AR::Relation#using_readonly/using_writable) #15
Conversation
4d4af0a
to
f92a27d
Compare
f92a27d
to
1cb385b
Compare
91cbb97
to
cb9c0bb
Compare
I tried this branch and found a strange behavior.
Is the last behavior intentional? |
Sorry, it is a bug. |
README.md
Outdated
Article.where(id: 1).using_writable.update_all(title: 'new title') # Write to db-blog-master | ||
``` | ||
|
||
Note that `AR::Relation` extension support is Rails version 4 or higher. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"extension is only supported in Rails 4.0 or higher"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! fixed 22b0a39
lib/switch_point/relation.rb
Outdated
module Relation | ||
attr_writer :proc_to_give_switch_point_mode | ||
|
||
def exec_queries(*args, &block) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def exec_queries(*)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! fixed 1afdd17
The connection used depends on the timing of relation evaluation.
I extend the AR::Relation to add the following method:
Please review 🙏