How do I best run a search on Date when it is not a :has_many association?

Posted by Angela on Stack Overflow See other posts from Stack Overflow or by Angela
Published on 2010-04-27T00:52:10Z Indexed on 2010/04/27 0:53 UTC
Read the original article Hit count: 303

Filed under:
|

I have a number of activities that have a calculated scheduled date. The activities, for example, Email, have a email.days method which is the days from a Contact.start_date on which it should be sent.

This means contact.start_date + email.days yields a date on which email is sent to contact.

I would like to use link_to around the date, so I can see all the emails and associated contacts that are to be scheduled on that date.

However, this "date" is not an attribute or an associate, so I'm not linking to a model's view. It's calculated.

So:

1) What should the actual "format" of the date that gets passed in the URl be? What is the method to do the consistent conversion?

2) How do I (find) all instances, because this "date" is not an actual attribute, is it a calculated value which changes depending on the two associated models of Contact and Email.

Thanks.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about datetime