Forum: Ruby on Rails Remove item from session

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Michel D. (Guest)
on 2006-06-12 17:15

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
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] ||=
  session[:subscriptions] = @subscriptions

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


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?

This topic is locked and can not be replied to.