Thank you Juan and Colin.
One thing I didn't mention is that canceled_time comes from different
class where the relationship is:

class CourseDate < ActiveRecord::Base
  has_many :course_lessons
end

CourseLesson
class CourseLesson < ActiveRecord::Base
  belongs_to :course_date
end

so in the query:
@course = CourseDate.find_all_by_date_and_canceled_time(Date.today,nil)

'date' is in table 'course_dates'
'canceled_time' is in table 'course_lessons'

So the suggested:
CourseDate.where(:date => Date.today, :canceled_time => nil)
did not work (thanks Juan)

But I'm getting all records for today (and their related lessons),
eventhogh one of the records has its 'canceled_time' set with time. I'm
of course expecting to get only those records with 'canceled_time' not
set.

I'm using rails 3+

Colin, scope names looks elegant and I'll use it, but first I would like
to get my original query working.

Any hints how ?

Thanks

Dani

-- 
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