How to manage session with multiple records

Hi, I am new to Ruby. I want to develop one page with multiple child records associated with master record.

So basic idea is to have one contact dropdown and add multiple contacts in session.

After saving contact is session, display added contact records in the same page with remove link. Up to this data is managed in session only.

After click on final save button, master record will be saved and all the contact records of session also needs to be saved.

Can anyone guide me how to develop this kind of scenario.

Thanks in advance.

Hi, I am new to Ruby. I want to develop one page with multiple child records associated with master record.

Have you searched some the examples that use accepts_nested_attributes_for ? A lot of tutorials/examples on it cover the ability to add/edit multiple child records is

Fred

Hi,

I am new to Ruby.

I want to develop one page with multiple child records associated with

master record.

So basic idea is to have one contact dropdown and add multiple contacts

in session.

After saving contact is session, display added contact records in the

same page with remove link. Up to this data is managed in session only.

After click on final save button, master record will be saved and all

the contact records of session also needs to be saved.

Can anyone guide me how to develop this kind of scenario.

Try accepts_nested_attributes_for. Apart from this, why do you want to use sessions for this. The way I am looking at your application, you are actually saving the user’s preferences/ changes in the session for some time and then doing a DB update when the user clicks on Save button. Why not store the user preferences in a javascript object. I might be mistaken, but in my opinion I would never go for storing something in sessions, because unless you are encrypting them, they are vulnerable and there are many issues involved. Correct me if I am wrong.