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 14 forks source link

Increased decoupling #1

Open dasch opened 12 years ago

dasch commented 12 years ago

Would it be possible to maintain a greater degree of decoupling between the subject models and the Event model? In particular, the cia_events and cia_attribute_changes feel a bit backward to me: we could just as well do eg. CIA::Event.for_subject(subject) and CIA::AttributeChange.for_subject(subject). That way, the subject classes need to know less about CIA.

grosser commented 12 years ago

I see your point, I think its a question of convenience vs decoupling, user.cia_events.first reads nicer to me then CIA::Event.for_subject(user). I dont think there will be any collisions and it is pretty easy to search.replace. Do you have any special scenario in mind that would be fixed/improved or just as a general decoupling ?

dasch commented 12 years ago

It's mostly in order to facility easy testing with stubs. Stubbing associations is notoriously hard in Active Record :-/

grosser commented 12 years ago

No problems so far, lets add them if we need them :)