Ahh that explains it postmodern, thanks.

It was working in development because I was using shotgun, so there
the file was always being reloaded.

cheers,

DAZ

On Apr 15, 10:28 am, postmodern <[email protected]> wrote:
> The value of :default is an expression that only gets evaluated once.
> When using a proc { }, DataMapper::Property recognizes it responds to
> #call and calls it for every new Property.
>
> On 04/15/2011 02:16 AM, DAZ wrote:
>
>
>
>
>
>
>
> > Thanks postmodern - that works perfectly now. How come?
>
> > cheers,
>
> > DAZ
>
> > On Apr 15, 10:17 am, postmodern <[email protected]> wrote:
> >> Put a proc { |model,property| } around that default.
>
> >> On 04/15/2011 02:06 AM, DAZ wrote:
>
> >>> Hi,
> >>> I have the following property that I want to create a 2-digit random
> >>> string when a resource gets created:
> >>> property :salt,         Text, :default => rand(9).to_s +
> >>> (1+rand(8)).to_s
> >>> In development on my local machine this works fine, but in production
> >>> (on Heroku) this gives the same value for resources created at around
> >>> the same time.
> >>> Anybody know why this might be and a possible workaround?
> >>> cheers,
> >>> DAZ
>
> >>  signature.asc
> >> < 1KViewDownload
>
>
>
>  signature.asc
> < 1KViewDownload

-- 
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