[ANN] Magma seasideHelper and Tutorial

Aaron Rosenzweig aaron at cocoanutstech.com
Wed Jan 30 05:48:49 UTC 2008


Hi Keith,

I'm trying your tutorial out now too and am experiencing the same  
issue as Robert and itsMe213. That is that "users" are persisted but  
the any new tasks they created are not.

Good news! I figured it out.

The issue is that when you follow the tutorial on Potsdam, they never  
actually put the "tasks" in the "user" object. You are going to have  
to do that yourself and when you do, Magma works like a charm. Here  
are excerpts of my relevant methods:

StUser...
addTask: aTask
	(self tasks includes: aTask) ifFalse: [self tasks add: aTask].
	^ aTask.

StLoggedInComponent...
initialize
	super initialize.
	self initializeMenuComponent.
	self initializeListComponent.
	self listComponent items: self session user tasks.
	Transcript show: 'Initialized listComponent'; cr.
	self listComponent items isEmptyOrNil ifTrue: [
		Transcript show: 'Making test tasks'; cr.
		self listComponent items: self testTasks].
	taskEditor := StTaskEditor new.

testTasks
	^ OrderedCollection
		with: (self session user addTask: (StTask new
			deadline: Date yesterday;
			completed: false;
			taskName: 'Missed task'))
		with: (self session user addTask: (StTask new
			deadline: Date tomorrow;
			completed: false;
			taskName: 'Pending task'))
		with: (self session user addTask: (StTask new
			deadline: Date tomorrow;
			completed: true;
			taskName: 'Already completed task'))

createNewTask
	| answer newTask |
	answer := self call: (self taskEditor newTask; yourself).
	answer ifTrue: [
		newTask := self taskEditor task.
		self session user addTask: newTask].

Cheers,
-- Aaron

On Jan 9, 2008, at 11:52 PM, Keith Hodges wrote:

> itsme213 wrote:
>> "Robert Schwarz" <r.schwarz at blackstream.at> wrote in message
>>
>>
>>> When I call "self session db addUser: 'aUser' in a renderContentOn
>>> method, the new user was added to the STMagmaDatabase dictionary but
>>>
>>
>> I noticed this too; changes at the root itself are persisted.
>>
> This shouldnt be too hard to sort out... gimme a couple of days...
>
> Keith
> _______________________________________________
> Magma mailing list
> Magma at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/magma



More information about the Magma mailing list