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.

Accessing version of newly created WikiContent results in NoMethodError (Bug #537)


Added by Gregor Schmidt at 2011-07-25 02:44 pm. Updated at 2011-07-25 05:10 pm.


Status:Closed Start date:2011-07-25
Priority:Normal Due date:
Assignee:Holger Just % Done:

0%

Category:Wikis
Target version:2.1.0
Remote issue URL: Affected version:2.0.0

Description

When executing the following code, I'm getting 0 in Chili 1.x while I get an error in Chili 2.0:

WikiContent.new.version

The error output looks like the following

NoMethodError: You have a nil object when you didn't expect it!
You might have expected an instance of ActiveRecord::Base.
The error occurred while evaluating nil.update_attribute
    from app/models/wiki_content.rb:65:in `version'
    from (irb):2

The code creates an initial journal - which involves a db update - which seems to be wrong since I did not save anything up to this point. I think, the version method should simply return 0 for new records.

A pull request including a new test is attached.


Associated revisions

Revision bf14f352
Added by Gregor Schmidt at 2011-07-25 07:07 pm

[#537] version of new WikiContents should be 0

History

Updated by Gregor Schmidt at 2011-07-25 02:52 pm

  • Status changed from Open to Ready for review

Updated by Holger Just at 2011-07-25 05:10 pm

Pushed to master. Thanks Gregor!

  • Subject changed from Accessing @version@ of newly create WikiContent results in NoMethodError to Accessing version of newly created WikiContent results in NoMethodError
  • Assignee set to Holger Just
  • Status changed from Ready for review to Closed

Also available in: Atom PDF