Hi list,
Is there a better/simpler way to code an inner join, than the 4 lines below:
class Day < Foo
def self.find_all_with_appointments (*args)
find :all,
{ :select => ''distinct foos.*'',
:joins => ''INNER JOIN appointments ON
days.appointment_id
= foos.id''
}.merge (extract_options_from_args!(args))
end
has_many :results , :class_name => "Result",
:foreign_key
=> "event_id"
end
:include doesn''t help here, as it produces an outer join.
Alain
Reasonably Related Threads
- bug? : STI and :include => fk and class_name MUST be specified
- [RFC PATCH v7 53/78] KVM: introspection: add KVMI_VCPU_CONTROL_EVENTS
- [RFC PATCH v7 44/78] KVM: introspection: add KVMI_VM_CONTROL_EVENTS
- complete stumper: variable exists in hidden_field_tag, but nil everywhere else
- [PATCH v9 45/84] KVM: introspection: add KVMI_VM_CONTROL_EVENTS
