I’ve conceided to using the in place design for storing personalized data by using property_type table and properties table. I did so manually in the property_type table and also in the property table. I added a subcategory (Basic, Personal, Work, and Education). Within Basic, I added attributes (Interest In, Relationship, Status, Looking For, Political View, Religious View). Within Personal I added attributes (Activities, Fav Music, Fav Movies, Fav Books, Fav Quotes, Fav TV Show, About Me, and Interests). Within Work I added attributes (Employer, Position, Description, Time Period). And Within Work I added attributes (School, Concentration, Start Year, End Year).
Manual personalized field mysql inserts:
insert into property_types (parent_id, title, short_name, description, is_global, order_by) values (98, “Time Period”, “emp_time”, “Work Time Period”, 1, 102);
insert into properties (user_id, property_type_id, value, created_at, updated_at) values (9, 102, “Now”, NOW(), NOW());
Now to add these property_types into all the rest of the users into the properties table. Fire up the development console (ruby script/console)
First to list all of the new property_type id’s
myPropertyTypes =[69,80,81,82,83,94,85,86,87,88,89,90,91,93,95,96,97,99,100,101,102]
Then walk through the user list and associate each property_type to each user.
User.find(:all).each { |usr|
myPropertyTypes.each { |pt|
tmp = usr.properties.create(:user_id => usr.id, :property_type_id => pt, :created_at => Time.now, :updated_at => Time.now)
tmp.save
}
}