Forum: Ruby on Rails Day.find_all_with_appointments - INNER JOIN

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Alain R. (Guest)
on 2006-01-10 19:51
(Received via mailing list)
Hi list,

Is there a better/simpler way to code an inner join, than the 4 lines

     class Day < Foo

         def self.find_all_with_appointments (*args)
             find  :all,
             {  :select => 'distinct foos.*',
             	:joins => 'INNER JOIN appointments ON days.appointment_id
             }.merge (extract_options_from_args!(args))

         has_many    :results  , :class_name => "Result", :foreign_key
=> "event_id"

:include doesn't help here, as it produces an outer join.

This topic is locked and can not be replied to.