This mixin is injected into the dynamically generated Revision class. You can customize this in your application to store extra fields per revision.
Methods
Attributes
| [RW] | create_time | The create time for the revision. |
Public Class methods
Override to handle your options.
[ show source ]
# File lib/og/model/revisable.rb, line 40
40: def initialize obj, options = {}
41: revision_from(obj)
42: @create_time = Time.now
43: end
Public Instance methods
Alias for #revision_to
[ show source ]
# File lib/og/model/revisable.rb, line 45
45: def revision_from obj
46: for a in obj.class.serializable_attributes
47: unless a == obj.class.primary_key
48: instance_variable_set "@#{a}", obj.send(a.to_s)
49: end
50: end
51: end
This method is also aliased as
apply_to
[ show source ]
# File lib/og/model/revisable.rb, line 53
53: def revision_to obj
54: for a in obj.class.serializable_attributes
55: unless a == obj.class.primary_key
56: obj.instance_variable_set "@#{a}", self.send(a.to_s)
57: end
58: end
59: end