My guess would be that the newsletters were added after the first time you
called the getNewsletterIterator method.  If you're storing the user record
in the session then its instance data sticks around for the life of the
user's session.  This means that if you called getNewsletterIterator that
the resulting iterator is also cached in the session.  If you called
getQuery the data was then cached in the session.

The easiest solution would probably be to call reset on the iterator before
calling getQuery.  Give that a shot and see what happens.

The other thing I've noticed by having records in the session is if you
change the object the changes don't show up in the object.  You have to log
our or otherwise clear you session to see the updates.

Doug

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Erik-Jan Jaquet
Sent: Sunday, April 30, 2006 4:14 AM
To: [email protected]
Subject: [Reactor For CF] Strange behaviour

Hi all,

I am still working on the app with Model-Glue and Reactor, and I am
wondering if someone could explain why i get a certain behaviour.

I copied the security setup from Doug's Blog example. I now have a user that
can log in, that works like a charm. But I have added a relationship to that
user, a user now hasmany newsletters.

I have the userrecord available in my view at all times, so I thought I
could just call the newsletter_iterator at all times, to see which
newsletters the user subscribed to.

But the strange thing is, when I call the iterator, it returns an empty
query. At first I thought it had something to do with my setup, but when I
run the code on a test page, without Model-Glue, it works fine! I get a
query with 3 records, which is what I expected.

I checked the userid in ModelGlue, it returns the correct user, so the
record is loaded with the correct user. 

But why is the newsletter_iterator coming up with no newsletters then? Can
anyone tell me if this is expected behaviour, while working with Model Glue,
or am I missing something?

Kind regards,

Erik-Jan



 

-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/



 

-- Reactor for ColdFusion Mailing List -- [email protected]
-- Archives at http://www.mail-archive.com/reactor%40doughughes.net/


Reply via email to