Good stuff.  Probably should belong in the model however, as a validation.

Sean

Daniel Sheppard wrote:
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.

We've already got a version number - the modification date. All you'd
need to do would be to add:

<input type="hidden" name="last_modified" value="<%=
@page.updated_at.to_i if @page.updated_at %>">

And in the controller:

unless @page.updated_at.nil? || @page.updated_at.to_i ==
params[:last_modified]
        flash[:notice] = "Some informative message here"
else
        handle_new_or_edit_post
end

I just can't think of the message to display to the user, but that's
probably just a lack of sleep.

Dan.
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant


_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to