ActiveRecord Limitation (Advance)

Or is it ?

Need to be able to :-

@search =
Form.find(:all, :include=>[:form_type, :form_type_items],
:conditions=>…)

I need in the Form model a :form_type_items, the question is, what is
the relationship type?

Current Models:-
Form
belongs_to :form_type

FormType
has_many :form_types
has_many :form_type_items

FormTypeItem
Belongs_to :form_type

Form

id
form_type_id

FormType

id
name

FormTypeItem

id
form_type_id

title

Form
belongs_to :form_type
has_many :form_type_items, :through => :form_type

On 8/2/07, nigel.bris [email protected] wrote:

| id |

title


Cheers!

Unfortunately, that code fails with:-

Mysql::Error: #42S22Unknown column ‘form_types.form_type_id’ in ‘on
clause’

as this is not a:-

pk<-(fk/fk)->pk relationship.

its a fk->(pk)<-fk, any ideas what the relationship type is in that
case?

Thanks

nigel.bris wrote:

Need to be able to :-

@search =
Form.find(:all, :include=>[:form_type, :form_type_items],
:conditions=>…)

What error message do you get with that? Try it with hash (worked for
me):
Form.find(:all, :include => {:form_type => :form_type_items})

Worked Perfectly!

You guys are guru’s…

Ps… Didn’t know that hash inside include feature, rails amazes me
more everyday!

Thanks!

On Aug 3, 8:45 am, Dondi S. [email protected]