-
Notifications
You must be signed in to change notification settings - Fork 229
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
The lock
method conflicts with ActiveRecord::Querying#lock
#196
Comments
This is a tough one, because the design philosophy of |
It'll also break class User < ActiveRecord::Base
include Redis::Objects
counter :your_counter
end I solved the problem by moving it to a service object class CounterService
include Redis::Objects
attr_reader :id # for redis
def initialize(id)
@id = id
end
counter :your_counter
end class User < ActiveRecord::Base
def your_counter
CounterService.new(id).your_counter
end
end |
CC @tmsrjs - another issue related to |
@nateware I think this issue needs a fresh look. In particular, the fact that this collision causes Active Record's At a minimum, while this method name collision exists, I recommend updating the README to discourage mixing |
What is the consensus on this issues and the similar #191? I'm ok at this point if we want to rename the method to |
This has been fixed in |
Class method
lock
defined inRedis::Objects::Locks::ClassMethods
conflicts withlock
inActiveRecord::Querying#lock
, which makes it impossible to enable ActiveRecord Pessimistic Locking byAccount.lock.find(1)
.We can still chain the method like this
Account.wherer(id:1).lock.take
. but that is dirty and better be avoided.This issue could be part of #153 .
The text was updated successfully, but these errors were encountered: