Re: My first web app... (still)
Re: My first web app... (still)
- Subject: Re: My first web app... (still)
- From: Chuck Hill <email@hidden>
- Date: Tue, 5 Jun 2007 10:00:46 -0700
On Jun 4, 2007, at 10:14 PM, Mac Campbell wrote:
Hello all,
Maybe you can help me out with another question...
I am working on a blog app as my first app... I have 3 major
outstanding issues the major one that I am most lost on is... my
tag system does not increment the tag counts right away... the only
way the tag area shows the correct number of tags (for newly added
tags, in debug mode) is for me to stop and start the app (in Xcode
newest / last version) and start it again, although added blog
posts do appear in the blog posts list...
The primary cause of this is not correctly updating the object graph
when adding new objects. How are you adding the tag? You should be
using the addObjectToBothSidesOfRelationshipWithKey method. Or, as
Mike will soon say, use Wonder and his EOGenerator templates from the
WO wiki so that you don't have to remember to do this. For you, for
now, I would just use that method.
I have the WO Repetition that goes through my array of tagEntries
displaying each unique tagEnumerator pertinent code below on the
main page:
public NSArray tagEntries()
{
tagEnumerator = null;
tEntrys = null;
//EOEditingContext ec3 = new EOEditingContext();
BlogEntry blogEntrys = new BlogEntry();
EOFetchSpecification fs =
EOFetchSpecification.fetchSpecificationNamed("tagsDescending",
"Tags");
NSArray keypaths = new NSArray();
keypaths = keypaths.arrayByAddingObject("blogEntrys");
//keypaths = "blogEntrys";
fs.setPrefetchingRelationshipKeyPaths(keypaths);
Not related, but you are writing too much code;
fs.setPrefetchingRelationshipKeyPaths(new NSArray("blogEntrys"));
You might also want
fs.setRefreshesRefetchedObjects(true);
NSArray tEntrys= new NSMutableArray(ec
().objectsWithFetchSpecification(fs));
return tEntrys;
}
After a new blog post is added (on the addPost page) the main page
is called:
....
// commit the changes made to the objects in the editing
context to the database
ec.saveChanges();
// refresh the page by fetching the page without recreating
a new session
//Main nextPage = (Main)pageWithName("Main");
return pageWithName("Main");
}
The thing in WO Repitetion doing the actual count is
"tagEnumerator.blogEntrys.@count"
Any ideas? It only shows an accurate count when you first start up
the app...?
Thanks,
Mac
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40global-village.net
This email sent to email@hidden
--
Practical WebObjects - for developers who want to increase their
overall knowledge of WebObjects or who are trying to solve specific
problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden