Friday, July 29, 2011

[Rails] Re: Actionmailer Help Needed

On Jul 29, 1:05 pm, Jenny Blunt <li...@ruby-forum.com> wrote:
> I've tried doing this in my tasks controller to list all users with
> upcoming tasks but it's not working...
>
>     @task = Task.all
>      @user = User.find(:all, :conditions => ["@task.dueddate <= ? AND
> @task.status = ?", Date.today + 7.days, false])
>
You would need to join the tasks table. Once you've done that,
remember that you conditions are an sql fragment so you can stick
conditions on tasks.duedate.
You'll also need to use group by or disctinct to not get duplicate
users.

Another approach might be to just get all the overdue tasks and
collect their users (removing duplicates obviously)

Fred
> --
> Posted viahttp://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 rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate