Thanks Solnic,

Is there any 'best practice' way of doing this sort of thing?

For example, do I use an after :create hook and then call self.save at
the end?
eg
 after :create do
    self.url ='/mysite/' << self.id.to_s
    self.save
 end


On Apr 4, 4:10 pm, Piotr Solnica <[email protected]> wrote:
> On Apr 3, 1:52 pm, DAZ <[email protected]> wrote:
>
> > Hi Solnic,
>
> > Yes, using after :create makes more sense.
>
> > I still have the problem that although the url property is then
> > successfully created, it is not persisted itself.
>
> > Should I save again? That seems wasteful to have 2 saves for every
> > page created.
>
> You need to save a resource if you want to use its serial value to set
> the url.
>
> Cheers
>
> # solnic

-- 
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en.

Reply via email to