I am doing a rss feed who reports all the changes in the program.
all changes are sent to a database where the afected item, who made
changed, time of change and a string reporting the change is kept
the problem is that the string who reports the change is too generic,
something like: Task 'xtask' was updated
i would like to know if its possible to know what was changed with
update_attributes (i know it updates all the attributes), without
needing to check the before and after in the database
the hash parameters for update_attributes come from a form_for
You might... the problem with the callbacks is you don't get access to the user who did it (depending on how they've logged in), nor can you ignore any trivial changes -- although that might not be a requirement here...
Below was my solution for selectively logging actions...
That's a great point Philip. I'm actually trying to solve that very
problem in a project I'm working on.
I want to be able to do exactly what lighthouseapp does when it logs
ticket updates. In that case, you have comments that people can make
on a ticket. But when someone updates the ticket, I want to create a
comment and log who changed what. I've now learned you can't do that
with a simple model observer (because I need to know who is updating
the ticket, which is part of the session).
I searched around on this list and the only thing I've found with any
substance is people recommending the cache sweeping recipe from the
book rails recipes. I'm digging into that now....
In your case though, you're creating a separate model (AuditLog) in
the controller...I want to keep this out of the controller.
Do you have any experience with cache sweeping for this purpose?
That's a great point Philip. I'm actually trying to solve that very
problem in a project I'm working on.
I want to be able to do exactly what lighthouseapp does when it logs
ticket updates. In that case, you have comments that people can make
on a ticket. But when someone updates the ticket, I want to create a
comment and log who changed what. I've now learned you can't do that
with a simple model observer (because I need to know who is updating
the ticket, which is part of the session).
I searched around on this list and the only thing I've found with any
substance is people recommending the cache sweeping recipe from the
book rails recipes. I'm digging into that now....
In your case though, you're creating a separate model (AuditLog) in
the controller...I want to keep this out of the controller.
Do you have any experience with cache sweeping for this purpose?
Honestly it was long enough back I don't remember It might have been that I didn't want to log all updates, only at certain times that had me keep it out of any cache/observers...