John W. Long said the following on 02/01/2007 11:28 AM:
> [...]
>
> Perhaps instead of locking, we should add a simple version constraint.
> We could add a field to the page called version. Version would be
> incredimented every time the page is saved. Before the save the page
> would simply verify that the new version is only one higher than the old
> version. If the versions were not correct we would know that someone had
> edited the page in our absence and could request action from the user.
>
> Would something like that be sufficient? Isn't there a Rails plugin that
> implements something similar?
On p222/3 of AWDwR-1 (Someday I'll get to -2) there's a note about locking.
It seems RoR can do this. no need for a plugin.
<quote>
Optimistic locking is enabled by default on any table that contains a
trigger column <tt>lock_version</tt>. You should arrange for this to be
initialized to zero for new rows, but otherwise lave it alone - ActiveRecord
manages the details for you.
</quote>
Apparently this doesn't prevent a second opening, but if when you try
writing back the version# is compared and if it has already been updated an
exception gets thrown.
Of course you have to catch the exception :-)
TNSTAAFL
--
Operationally, God is beginning to resemble not a ruler but the last fading
smile of a cosmic Cheshire cat.
Sir Julian Huxley
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant