kingston.s
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAC2JRvHk-%3D8MmUmny_ovKKVbEQD6%3D%2By3Bc5-MDssvcBNUYxCrA%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
You might need to write a migration or rake task for this purpose.
Migration may look like this.
class MigrateData < ActiveRecord::Migration def change get_all_models.each do |model| model.where('').find_each do |model_instance| model_instance.update_attributes id: UUIDTools::UUID.random_create.to_s end end end def get_all_models Module.constants.select do |constant_name| constant = eval constant_name if not constant.nil? and constant.is_a? Class and constant.superclass == ActiveRecord::Base constant end end end end
Site
, Country
,Payment
, SiteUserRole
and Event
. If that's true then you don't have to worry about that. The migration, that I shared before, will iterate through all these models and ID
in every database table will be replaced with generated UUID.