开发者

Implementing Undo & Redo in the controller/view

I'm using paper_trail to implement versioning in my Rails app. I've run into a bit of a head scratcher开发者_运维技巧 when tying the back end into my front end.

Since I allow users to update record (create new versions) via AJAX, the "undo"/"redo" functionality has to be tied to the state of the current page (somehow), rather than calculated in the controller. One idea I had was to return the latest version number with every AJAX request, and then update my "undo" link with this version number.

Has anyone else grappled with this? What's the best way to do it?


I don't see anything wrong with the way you answered your own question:

One idea I had was to return the latest version number with every AJAX request, and then update my "undo" link with this version number.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜