grosser / cia

Central Internal Auditing: Audit model events like update/create/delete + attribute changes + grouped them by transaction, in normalized table layout for easy query access.
12 stars 18 forks source link

Allow attribute changes without source #5

Closed seancaffery closed 11 years ago

seancaffery commented 11 years ago

This will allow attribute changes to be saved without having the class that contains the change available. The validates_presence_of method tries to load the class associated with the attribute change because of the polymorphic association on source this is a problem when the project that handles auditing does not contain the classes for the audited change. I chose to follow the rules on the Event class for determining the need for a source. It might also require some protection on the source association as well.

/cc @grosser

grosser commented 11 years ago

Looks good, an additional validates_presence_of :source_id, :source_type, :unless => :source_must_be_present? would be nice, so we do not end up without an id/type :)

maybe those validations can go into a module like SourceValidation

seancaffery commented 11 years ago

Fair enough. Done :) The rails 2 build is failing, but I am not sure why. Any ideas?

grosser commented 11 years ago

v0.5.3 is out!

test fixes https://github.com/grosser/cia/commit/b4044290d866cae1bfabe1ce6e58fafb46967d64