ruby api wrapper - ticket search parameters?

Krister Axel's Avatar

Krister Axel

14 Nov, 2008 05:50 AM

Hello again. I am moving quite quickly on my project, and I have both Ruby and Lighthouse to thank.

Anyway, running into another problem:

how do I push search parameters to the tickets subquery?

I got this from lib/lighthouse.rb

def tickets(options = {})
  Ticket.find(:all, :params => options.update(:project_id => id))

what would the syntax be to return closed tickets?

i.e -

def tickets_closed(options = {})

  Ticket.find(:all, :params => options.update(:project_id => id, :state => "resolved"))

what would the syntax be to ask for "created_at < #{ - 90}" ?

I've tried a few different things. Basically, the Ticket.find won't take a :conditions array, the above doesn't work, and I don't see created_at in the class attributes but I know I can access it as a field value. I'm going to keep working on this, and if I come up with something I will post it, but if someone would like to lead me out of this desert I would be obliged.


  1. 1 Posted by Krister Axel on 14 Nov, 2008 05:53 AM

    Krister Axel's Avatar

    got it:

    x = Ticket.find(:all, :params => options.update(:project_id => id, :q => "state:resolved"))

    it's the "q" parameter. Very James Bond.

  2. 2 Posted by Krister Axel on 14 Nov, 2008 06:11 AM

    Krister Axel's Avatar


    Ticket.find(:all, :params => options.update(:project_id => id, :q => "created:'#{i.abs} month ago'"))

  3. 3 Posted by Justin Palmer on 14 Nov, 2008 09:33 PM

    Justin Palmer's Avatar

    kristert is right. You should also checkout the "Date based keywords" section of our help section. The date-based searching is pretty powerful.

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