Hi Abhishek
You could override the rails defaults of autoincrementing with following
create_table(table_name,:id => false) do |t|
t.integer :id,:options => 'PRIMARY KEY'
end
Force fully in your controller you should pass the value to :id .
Hope this helps ,
Srinivas Iyer
http://talkonsomething.com
On Thu, Nov 19, 2009 at 8:43 PM, Rick <[email protected]> wrote:
> I would like to extend this discussion somewhat as I don't see any
> guarantee that the id generated by "the authlogic method" will in fact
> meet the requirement placed on that generated by uuid.
>
> The UUID (Universally Unique IDentifier) has it's primary requirement
> spelled out in the name. The provided id is meant to be unique across
> multiple platforms without requiring any interplatform syncronization.
>
> At it's base, authlogic provides an identifier (session key) which is
> a random number. The random number source has evolved over time with
> the current (inside RoR) technique provided in Ruby 1.9 being
> SecureRandom. Rails 2.3.4 also provides ActiveSupport::SecureRandom
> which provides equivalent functionality and defaults to Ruby1.9 if
> present.
>
> SecureRandom will use, preferentially:
> ossl library random_bytes()
> /dev/urandom
> Window's CryptGenRandom
>
> My problem is that I cannot find any guarantee that SecureRandom will
> provide a value that meets the UUID requirement. Can anyone see what
> I'm missing here?
>
>
> On Nov 19, 2:28 am, Abhishek shukla <[email protected]> wrote:
> > Hello Darian,
> > Thanks for your reply, Basically for generating Primary Key which is not
> > just an auto increment.
> >
> > thanks
> > abhis
> >
> > On Thu, Nov 19, 2009 at 12:18 PM, Darian Shimy <[email protected]> wrote:
> > > Alternative to what? If you need ideas, take a look at how Authlogic
> > > generates them in the Authlogic::Random module.
> >
> > > Darian Shimy
> > > --
> > >http://www.darianshimy.com
> > >http://twitter.com/dshimy
> >
> > > On Wed, Nov 18, 2009 at 10:39 PM, Abhishek shukla <
> [email protected]>
> > > wrote:
> > > > Hello Friends,
> > > > Is there any better alternative for UUID? Can you please provide me a
> > > link.
> >
> > > > Thanks
> > > > Abhis
> >
> > > > --
> >
> > > > 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]<rubyonrails-talk%[email protected]>
> <rubyonrails-talk%[email protected]<rubyonrails-talk%[email protected]>
> >
> > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/rubyonrails-talk?hl=.
> >
> > > --
> >
> > > 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]<rubyonrails-talk%[email protected]>
> <rubyonrails-talk%[email protected]<rubyonrails-talk%[email protected]>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/rubyonrails-talk?hl=.
>
> --
>
> 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]<rubyonrails-talk%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=.
>
>
>
--
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=.