Comments
-
Greg Hurrell
See also ticket #1248, "Auto-save posts/articles etc being edited".
-
Greg Hurrell
Possibly useful examples:
-
Greg Hurrell
Another option to consider is storing stuff in a Git repo, which would give us some bonus behavior (logging, diffs) "for free", but would most likely be a little more IO intensive (forking out to
git
rather than accessing the database). -
Greg Hurrell
Another case which just bit me: session expired when window was left open for a long time. When I hit the submit button I got auto-redirected to the log-in page, and when I logged in I could no long use the back button to get back to the form (probably would have been fine if I had just clicked back rather than logging in).
So really need some kind of auto-save functionality for that.
-
Greg Hurrell
See also ticket #1935, which is about adding versioning to the snippets model.
-
Greg Hurrell
Easiest way to do this will be to have a
versions
table with a Yaml or JSON serialization of the versioned model (along with some meta info, such as related type, related id etc. -
Greg Hurrell
Envisioning an API something like this:
class Article < ActiveRecord::Base version :title, :redirect, :body end a = Article.first a.id #=> 1 a.version #=> 1 a.update_attribute(:body, 'more info!') a.version #=> 2 a.rollback a.body #=> 'original body' a.version #=> 1 a.reload a.version #=> 2 a.body #=> 'more info!' a.rollback! a.body #=> 'original body' a.version #=> 3 a.reload a.body #=> 'original body' a.rollback(3.minutes.ago) a.version #=> 1 a.reload a.version #=> 3 a.rollback!(3.minutes.ago) a.reload a.version #=> 4 Version #=> Version(id: integer, versioned_id: integer, versioned_type: string, version: integer, content: text) Version.last.content #=> { title: 'dat article', redirect: '', body: 'original body' }
-
Greg Hurrell
See also issue #2198.
Add a comment
Comments are now closed for this issue.