For instance, if you wanted to edit client-site.com/pages/5 , you would go to admin-site.com/pages/5/edit . I want to only let one admin access admin-site.com/pages/5/edit at a time.
What I was planning on doing is creating the "editor_id" and "editing_rights_expiration_time" columns in the database, and updating them with JavaScript/server-side logic. Is there a better way of implementing this feature?
I'm using Rails 3.
I suspect a better way to handle this would be to use optimistic locking:
You might want to look at an optimistic locking strategy, so let as many users as neccessary edit the page. But when the user tries to save the data check if the token has changed and reject the edit. For example:
Oh looks like Rails has this already as @Andy Waite (+1) has mentioned.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.