views:

206

answers:

5

I'm wondering if there's an integrated solution to have a database with versioned records supported by rails (ala version_fu ar_versioned) and a differ thanks!

A: 

As you noted, that functionality is supported in plugins, and won't be supported by Rails core.

Joe Van Dyk
+1  A: 

Check out acts_as_versioned.

webmat
A: 

There is a forked version of acts-as-versioned (ar-versioned) that includes an additional column in the versioned table (updated-attributes) that is a hash of what was changed.

srboisvert
A: 

I ended up using acts_as_audited to accomplish this along with the htmldiff plugin to get some pretty output.

see: http://stackoverflow.com/questions/80091/diff-a-ruby-string-or-array/739161#739161

Brian Armstrong
+1  A: 

Thanks srboisvert for mentioning my fork. Here's a bit more info/context. The updated_attributes column's value is set for each version, and lists what attributes were changed from the prior version. This is useful when you need to display a record/version and want to show what values changed. I needed this to implement a history view for a particular record we had, where we wanted to color any changed values red in each version we displayed in the history. This is covered in my blog post which is linked above, along with a couple other minor tweaks.

If anyone tweaks it further, please do send me a pull request, etc.

chrisrbailey