body & body_html sometimes nil

catwood's Avatar


10 Oct, 2007 01:53 AM

I'm extending our usage of the Lighthouse API and have run into a problem with getting to ticket.body and ticket.body_html - sometimes they are nil.

What is odd is the web application has the correct data for body - it is only missing in the API - and only on some tickets.


projects[0].tickets.collect{|t| t.body.nil? ? 0 : 1}.sum
projects[0].tickets.collect{|t| t.body.nil? ? 0 : 1}.length

gives 8 and 30, respectively.

Another thing that is odd is that we have 67 tickets filed for that project - but only 30 are returned on by that call. Is there some kind of pagination in the API?

  1. 1 Posted by catwood on 10 Oct, 2007 03:46 AM

    catwood's Avatar

    I figured it out myself. My .tickets method uses Lighthouse::Project.find - which only returns the most recent version of the ticket. In some cases the tags or state of the ticket was changing, without any new text - so the body was nil.

    What live done is to load the full ticket with Lighthouse::Ticket.find once I have the ticket number from the project search above. I can then get to the original body text with ticket.versions[0].body

    Sorry for the noise.

  2. 2 Posted by Rick on 10 Oct, 2007 07:05 PM

    Rick's Avatar

    This really gets into how Lighthouse is stored on the backend. Though, I'll likely be changing it really soon since I assume this is the expected behavior as far as the API goes.

Discussions are closed to public comments.
If you need help with Lighthouse please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac