mks mks Mon Dec 10 10:27:15 -0500 2012

Subject: access attributes has_many (don't know a better name for it)

Hi,
I got two classes: Person, Cars
one Person can has many Cars. Therefore my class Person has the "has__many" association.
Now my question: is it possible to access the cars of a person via:

___________________________________________________________________________________________
$person->cars; //returning an array of Cars or something similar
___________________________________________________________________________________________

Is it possible this way? Well, I tried it and it doesn't seem to work, but maybe i did something wrong...
Or do I have to do it always like:

___________________________________________________________________________________________
Car::all(array('conditions' => array('person_id' => $person->id)));
___________________________________________________________________________________________

br, mks

edit: maybe I should have posted it in the "Help-Forum" - sorry ;)


mks mks Mon Dec 10 10:43:47 -0500 2012

ha, forget my question, it does work - my failure.

(1-1/1)