I didn't know you could pass an array of arrays!

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 10/02/2009, at 6:29 AM, Gabi Ge <[email protected]>  
wrote:

>
> Jeff Burlysystems wrote:
>> How about:
>>
>> ...
>> require 'time'
>> ...
>> invoices = Invoice.find(:all, :conditions=>['issue_date is not null
>> and (issue_date >= ? or issue_date <= ?)', Time.parse('2009-02-09
>> 00:00:00'), Time.parse('2009-02-09 23:59:59')] :order=>'issue_date')
>> ...
>>
>> Jeff
>
> Thanks for your reply, and your help! It gave me a hint and solved the
> problem like this:
>
> self.cond << ["invoices.issue_date > ?", from - 1] unless from.blank?
> self.cond << ["invoices.issue_date < ?", to + 1] unless to.blank?
>
> because issue_date is a datetime, and generating an invoice means  
> saving
> both date and time of the day. This way the search will have the same
> results as in your example.
>
> Once again, thank you for your help!
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to