[Seaside] Re: [ANN] Magma Tutorial
keith_hodges at yahoo.co.uk
Tue Dec 18 13:44:50 UTC 2007
> I did get through Installer on 3.10gamma (but will have to revert to 3.9 as
> I cannot upgrade images right now). For now on to some persistence
> experiments ...
> Some newbie questions:
> Is StSession (or my session class) supposed to have an instVar #db, to be
> set to
> self db: (self magma rootAs: StMagmaDatabase) ?
This approach is the one followed by the StToDo Tutorial to which my
tutorial is a supplement to Chapter 8.
Their code has a specialized Session class with #db initialized as above.
Magma seasideHelper does not need this since it does not need a
specialized session class at all.
Instead 'Magma seasideHelper' simply provides WASession-#magma which you
can use anywhere that you wish.
So on a component that wants access to a database model.
^ self session magma rootAs: MyCustomers
^ self session magma rootAs: MyProducts
If MyCustomers and MyProducts are subclasses of WADictionaryRoot,
WAObjectRoot or MagmaCollection then this should work including
automatic initialization etc.
> If not, where is #db: defined? What is the object/instVar path between my
see the example code in squeaksource prjoject: 'ToDoTutorial' I think it
is - it is refered to in the wiki page.
> WAComponents and the instance of my Database class
> WADictionaryRoot subclass: #MyMagmaDatabase
> Also, are commits supposed to happen automatically after each server round
> trip? Does this work for Ajax updates? I am not seeing these commit changes
This depends on the helper class chosen. WAMagmaSoloAuto, and
MAMagmaShareAuto do automatic commits.
But as you surmise not for ajax updates.
These need a commit: or a #commitAndBegin. after data has changed.
> in the "commits" folder, and after I quit and restart my Squeak image
> without saving, I don't see the changes I made previously.
> Thanks - Sophie
great you are finally making progress
More information about the seaside