I have my Profile Migration like this :
class CreateProfiles < ActiveRecord::Migration
def self.up
create_table :profiles do |t|
t.integer :user_id
t.text :detail
t.boolean :visible
t.timestamps
end
add_index :profiles, :detail
end
def self.down
drop_table :profiles
end
end
And I have a User has_one Profile and Profile belongs_to User Relation.
Now, I want to store the Profile details as serialized. So I have the Profile class like this :
class Profile < ActiveRecord::Base
belongs_to :user
serialize :detail, Hash
end
This is because I want each user to be able to create different profile details, something like this
Profile.new.detail ={:education => ["Degree", true], :Hobby => ["Music", false] }
Now, since I have user_id has the other attribute, what command can I use for users to add new details ?
For
Profile has_many Details:For
Profile has_one Detail: