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)
Description
To reproduce:
- 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)
Associated revisions
[#441] Journals should touch their journaled to update updated_on/at fields
History
Updated by Eric Davis at 2011-06-02 04:57 am
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
Updated by Eric Davis at 2011-06-05 06:56 pm
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
Updated by Eric Davis at 2011-06-10 06:42 pm
Merged into release-v2.0.0 in ee9b129
- Status changed from Ready for review to Closed
Updated by Felix Schäfer at 2011-07-28 06:42 am
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_save
/after_destroy
(see add_touch_callbacks about that)?
Updated by Gregor Schmidt at 2011-07-28 05:31 pm
Attach is the proposed change in git patch format. The tests run fine on MySQL.
- File 0001-441-Updating-issue-on-comments-with-less-undesired-s.patch added
Updated by Felix Schäfer at 2011-07-29 09:34 am
Discussion moved to #543.