Module ActsAsRevisionable::ActsMethods
In: lib/acts_as_revisionable.rb

Methods

Included Modules

InstanceMethods

Public Instance methods

Calling acts_as_revisionable will inject the revisionable behavior into the class. Specifying a :limit option will limit the number of revisions that are kept per record. Specifying :minimum_age will ensure that revisions are kept for at least a certain amount of time (i.e. 2.weeks). Associations to be revisioned can be specified with the :associations option as an array of association names. To specify associations of associations, use a hash for that association with the association name as the key and the value as an array of sub associations. For instance, this declaration will revision :tags, :comments, as well as the :ratings association on :comments:

  :associations => [:tags, {:comments => [:ratings]}]

You can also pass an options of :on_update => true to automatically enable revisioning on every update. Otherwise you will need to perform your updates in a store_revision block. The reason for this is so that revisions for complex models with associations can be better controlled.

A has_many :revision_records will also be added to the model for accessing the revisions.

[Source]

    # File lib/acts_as_revisionable.rb, line 22
22:     def acts_as_revisionable (options = {})
23:       write_inheritable_attribute(:acts_as_revisionable_options, options)
24:       class_inheritable_reader(:acts_as_revisionable_options)
25:       extend ClassMethods
26:       include InstanceMethods
27:       has_many :revision_records, :as => :revisionable, :dependent => :destroy, :order => 'revision DESC'
28:       alias_method_chain :update, :revision if options[:on_update]
29:     end

[Validate]