You want to use Time.now.to_f if you're worried about more than one
hit per second.


On Aug 19, 11:44 am, Maurício Linhares <[email protected]>
wrote:
> Time.now.to_i
>
> -
> Maurício 
> Linhareshttp://codeshooter.wordpress.com/|http://twitter.com/mauriciojr
>
> On Wed, Aug 19, 2009 at 12:35 PM, James
>
> West<[email protected]> wrote:
>
> > I need to auto generate a guaranteed to be unique number or string to be
> > used something like this in a partial view <div id=<%=unique_div_id%>>
>
> > I thought of using time.now but that only goes to seconds. I have tried
> > rand(time.now) but that does not guarantee a nique ID.
> > There would be more than one partial created within any given second
> > hence the need for time in milliseconds.
> > It doesn't have to be a time function it can be anything so long as it
> > is fast, minimal memory footprint and can be stored in a variable for
> > use with a link_to_function that will toggle the visibility of the div.
>
> > I thought that this would be such a simple thing to do but I have been
> > tearing my hair out over this for days and I need a solution real fast.
>
> > Any ideas would be greatly appreciated
>
> > James
> > --
> > Posted viahttp://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" 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/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to