ChiliProject is not maintained anymore. Please be advised that there will be no more updates.
We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.
Creating a Journal does not update the journaled record's updated_at/on attribute (Bug #441)
- Create an issue (updated_on is set to A)
- Create a journal for the issue
- The issue's updated_on stays the same (updated on should have been A + some_time)
Having problems getting this to work. All it should be is to just add "touch" to a Journal (
belongs_to :journaled, :touch => true) but I'm now having to fix (brittle) tests in issues nested set, reload records in a bunch of tests, and now aaj isn't updating it's journal version (JournalObserverTest).
Could someone try this out and see if I'm missing something simple. I've already spent 4 hours on this...
- File 0001-441-Journals-should-touch-their-journaled-to-update-.patch added
- Status changed from Open to Needs more information
Found out that the JournalObserverTest wasn't creating the initial journals correctly sometimes which was causing the version problems. I ended up fixing the test by removing the fixtures and adding in factories.
Final code in https://github.com/chiliproject/chiliproject/pull/72
- Status changed from Needs more information to Ready for review
Eric, we're having problems with StaleObjectErrors in migrations for journalized objects (similar to wiki pages), in tests, and I somehow remember other people having those too, I can't find them here though.
Anyway, I was able to find a (probable) culprit, it's the
:touch => true part in source:/app/models/journal.rb#L27, which gets triggered again if there's stuff done on the journal after it's been saved, as is e.g. the case with the
update_attribute in source:/app/models/wiki_content.rb#L96. I understand the need to touch the journalized object on journal creation, but it's not necessary on journal post-processing (I'd even say it's wrong).
Would you agree to moving the touch action to an
after_create callback instead of having it in an
after_destroy (see add_touch_callbacks about that)?