nateware/redis-objects — Issue #46: Allow for persistent locking when no block passed? 
Author: stephenhandley
Created: 2011-10-12 11:16:08+00:00
State: open

Seems like there would be some advantages in allowing for persistent locking/lock checking when no block is passed to #lock. Goal would be to support something like the following use case:

```
def edit
@object = SomeObject.find(params[:id])
lock = @object.lock
if lock
@object.update_attribute(:locked_by, current_user)
else
redirect_to(object_url(@object))
flash[:error] = "Object is currently unavailable for editing blah blah blah"
end
end

def update
@object = SomeObject.find(params[:id])
if @object.locked_by == current_user
params[:object][:locked_by] = nil
@object.update_attributes(params[:object])
@object.unlock
flash[:message] = "Object updated."
end
redirect_to(object_url(@object))
end
```