Remove item from session


#1

Hello,

i’m struggling with the following problem: I have a edit page wich
on wich a user can edit his Account information and add or remove
his Subscriptions. For the time the user is editing his Subscriptions
I’ll keep his subscriptions in a session. After the user has finished
adding and removing subscriptions I want to have the new set of
subscriptions
in the session. If the user validates his modifications, i’ll write the
modifications to the database.

I have the following code in my accounts_controller

def edit
@account = Account.find(params[:id])
@subscriptions = @account.subscriptions
session[:subscriptions] ||= Subscription.new
session[:subscriptions] = @subscriptions
end

the session[:subscriptions] contains all the subscriptions that
belong to a specific account.

i.e.

Account 1 has the following Subscriptions

1… Subscription 1
2… Subscription 2
3… Subscribtion 4
4… Subscribtion 7

My problem:
If the user click on de ‘Delete’ url for example on Subscription 4, i
want to
remove subscription 4 from the session. (So i don’t want to remove
that object fysically from the database). Does anybody know how to
do that?