|
From: Rupert B. <rup...@fr...> - 2005-11-04 22:58:59
|
Le 4 nov. 05 =C3=A0 22:04, Jonathan Paisley a =C3=A9crit :
> On 4 Nov 2005, at 20:53, Rupert BARROW wrote:
>
> Try replacing kvc_accessor with kvc_wrapper, as defined by Kimura =20
> Wataru in an email earlier today in this thread.
Sorry, I'm on a 'digest' mail subscription to the list, so I missed =20
your post, Kimura-San.
> This declares the ruby-level accessors in terms of setValue:forKey: =20=
> and valueForKey: which should hopefully solve the problem.
>
> i.e.:
>
> kvc_wrapper :lastName, :firstName, :employeeID
> kvc_depends_on=20
> ([ :lastName, :firstName, :employeeID ], :fullNameAndID)
>
> def initialize
> employeeID =3D @@lastID
> ...
> end
Great, thanks to both of you, things are now working, but not =20
*exactly* as you mention.
In my 'awakeFromInsert' method, why does
employeeID =3D 123 # not self.employeeID
puts employeeID
puts self
reply '123' for employeeID, but NOT update self :
<Employee: 0x520d00> (entity: Employee; id: 0x523ed0 <x-coredata:///=20
Employee/tFC895DBA-B5E8-4764-B296-32FA106D280E> ; data: {
department =3D nil;
directReports =3D ();
employeeID =3D nil; # not updated
firstName =3D First;
lastName =3D Last;
manager =3D nil;
salary =3D 0;
})
when
self.employeeID =3D 123 # using self.employeeID
puts employeeID
puts self
replies '123' for employeeID AND updates CORRECTLY self ?
<Employee: 0x520d00> (entity: Employee; id: 0x523ed0 <x-coredata:///=20
Employee/tFC895DBA-B5E8-4764-B296-32FA106D280E> ; data: {
department =3D nil;
directReports =3D ();
employeeID =3D 123; # updated correctly
firstName =3D First;
lastName =3D Last;
manager =3D nil;
salary =3D 0;
})
Thanks for your help. Being rather newbie on Cocoa/CoreData and =20
RubyCocoa, I do not know whether I am using incorrectly the former or =20=
the latter.
Cheers,
Rup=
|