I think that serial properties don't get set until the resource is saved. I tired using an after :save hook to set the url property using the id. This worked, but the url property wasn't saved!
There must be a standard way of setting property values that are based on the id .... isn't there? cheers, DAZ On Apr 1, 10:50 pm, DAZ <daz4...@gmail.com> wrote: > Hi, > > I'm trying to use the id of a resource to set a default value, but nil > keeps getting returned as the id: > > eg > > class Page > include DataMapper::Resource > property :id, Serial > property :url, Text, :default => Proc.new { |r, p| ('/ > mysite/'+r.id.to_s } > end > > Am I doing something stupid here? > > cheers, > > DAZ -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamapper@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.