if i were you i would back up my db and create migration to move everything
to different tables. In fact you could do a rake task for that.
desc "Fixing that crapping design"
task :fix_the_fail => :environment do
crappy_table = "crappy_table_name"
new_tables = ["table1","table2","table3"...etc]
category_a = ["Draperies_name","date","workroom_material_reference"...etc]
category_b =
["Upholstery_name","date","workroom_material_reference"...etc]
category_c =
["Lampshades_name","date","workroom_material_reference"...etc]
category_d = ["name","date","workroom_material_reference"...etc]
categories = [ category_a,category_b,category_c,category_d]
ActiveRecord::Base.establish_connection
i=0
ActiveRecord::Base.connection.tables.each do |table_name|
if new_table.include? table_name
data = ActiveRecord::Base.connection.insert(insert into table_name
categories[0] values (select categories[0] % crappy_table)
i++
end
end
end
end
something like that and just forget about everything before that
--
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.