Wheels.AssociationNotFound

35 views
Skip to first unread message

eric...@gmail.com

unread,
Apr 11, 2021, 3:49:38 PM4/11/21
to CFWheels
I will preface this issue with - I understand how associations work. 

I'm trying to convert to CFW 2.2 but have been using 1.4.5 for a long time.

Controller is as follows;

component extends="Controller" {
    function index() {
    tournaments = model("Tournament").findAll(where="fk_clubID = 2", include="TournamentType", order="isComplete, eventDate");
    }
}

Model is as follows:

component extends="Model" {

    function config() {
        hasOne(name="tournamentSeason", jointype="inner", foreignkey="TournamentSeasonID", joinkey="fk_tournamentSeasonID");
        hasOne(name="tournamentType", jointype="inner", foreignkey="TournamentTypeTypeID", joinkey="fk_tournamentTypeID");
    }

}

but i'm receiving an AssociationNotFound.

So... I'm a bit lost as to why. it's as if it's not even finding it - at all.

Any information would be helpful.

Tom King

unread,
Apr 11, 2021, 4:16:43 PM4/11/21
to CFWheels
Just to clarify - is this something which worked in 1.4.6 but doesn't in 2.2?
T

eric...@gmail.com

unread,
Apr 11, 2021, 4:23:44 PM4/11/21
to CFWheels
it's not in 1.4.5 etc. - this is just me trying to get something working.  is there something i'm missing here - it should be fairly straight forward. it's not erroring out - it's just not finding the model
. fyi - lucee 5.3 

eric...@gmail.com

unread,
Apr 11, 2021, 4:26:07 PM4/11/21
to CFWheels
And... models folder includes;

Tournament.cfc (model code above). 

Tom King

unread,
Apr 11, 2021, 4:28:57 PM4/11/21
to CFWheels
On a vary cursory glance, it looks ok to me.
Your error message should tell you a bit more detail, as in, which (exactly as named) association on which model it is... but yeah don't see anything weird in the code you've posted
T

eric...@gmail.com

unread,
Apr 11, 2021, 5:09:13 PM4/11/21
to CFWheels
Thanks for the insight. i went ahead and restarted lucee and it works - problem is - i reloaded it like 10 times to no avail. i've seen it get stuck like that on occasion but just didn't think to restart.

Tom King

unread,
Apr 11, 2021, 5:28:34 PM4/11/21
to CFWheels
Most odd; It's not something I've come across myself; I guess it's just a reminder to all that anything in config() (be it model or controller) usually requires a ?reload to get it going....
I guess if you've got any lucee settings like cached classes / inspect  = never you might hit that?
glad you got it working though!
T

eric...@gmail.com

unread,
Apr 11, 2021, 5:31:40 PM4/11/21
to CFWheels
yes - my local environment is a bit wonky sometimes. Most of my code is fairly stable so i'm not usually in a situation where i'm changing models. i probably should have just restarted from the beginning - but since i didn't have any models when i began this test i figured it'd be less of a problem. At any rate - all is well.
Reply all
Reply to author
Forward
0 new messages