Thanks for pointing this out Jon, I didn't realise there was a string
property. I've just been looking at the docs, but can't find what the
upper limit for the string type is (or what the difference between a
String and Text actually is).

In this case the :salt property will always be a 2-character string.
It's used to add some randomness to the short-urls I'm building.

I've also got fields of :email and :name that I think should probably
be of type String too.

There's also a 'message' filed, but that could be long so Text is
probably better, yes?

On a related matter, does it help adding a length argument such
as :length => 2 to these properties?

cheers,

DAZ

On Apr 15, 10:35 am, Jonathan Stott <jonathan.st...@gmail.com> wrote:
> Just as a more DataMapper question, what's the purpose of this field?
> A Text column is intended for storing large quantities of text, up to
> many kb/mb.  If it's just going to store a short string, a String
> column will be smaller and faster.
>
> Regards
> Jon
>
> On 15 April 2011 10:16, DAZ <daz4...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Thanks postmodern - that works perfectly now. How come?
>
> > cheers,
>
> > DAZ
>
> > On Apr 15, 10:17 am, postmodern <postmodern.m...@gmail.com> 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
>
> > --
> > 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 
> > athttp://groups.google.com/group/datamapper?hl=en.

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

Reply via email to