Forum: Ruby on Rails Can i store multiple values in session ? how?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
79356602b91cca9f1018d7dd99f69ed5?d=identicon&s=25 Trupti Bhatt (truptibhatt)
on 2007-02-09 11:24
hi,

i m calling following method on " onclick " event of checkbox and  i m
getting id of all selected checkboxes, but now i want to store multiple
ids to store in session , can i? or any other options?

def checksel
  @data=""

   data = params[:p_id]
   stat=params[:stat]

  if stat=="true"
    @tmp = data

  end
end
9949bb00c2d00d00753ab0134a99c447?d=identicon&s=25 syed arif (Guest)
on 2007-02-09 12:00
'The easy way is to concatenate the ids and store in the session
variable'
47c3920e98510f592b2e8dcf8bbaf07f?d=identicon&s=25 surfivor (Guest)
on 2007-02-09 12:31
(Received via mailing list)
On Feb 9, 5:24 am, Trupti Bhatt <rails-mailing-l...@andreas-s.net>
wrote:
>    stat=params[:stat]
>
>   if stat=="true"
>     @tmp = data
>
>   end
> end
>
> --
> Posted viahttp://www.ruby-forum.com/.


 You can store all kinds of stuff in a session, but it will all get
stored on your disk or wherever your sessions are stored and could
take up alot of space if you don't clear it out over time.

suppose myrec was an array of some kind of records. You could store as
many as you like in the session:


myid = :'id432343'
@session[myid] = myrec[0]
myid = :'id432343'
@session[myid] = myrec[1]

...
...
This topic is locked and can not be replied to.