# Sessions+draggable element

**URL:** <https://www.ruby-forum.com/t/sessions-draggable-element/143310>\
**Category:** Rails\
**Created:** [July 17, 2008, 8:05am UTC](https://www.ruby-forum.com/t/sessions-draggable-element/143310 "2008-07-17T08:05:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![torso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/34f0e0/32.png) [@torso](https://www.ruby-forum.com/u/torso)\
**Post date:** [July 17, 2008, 8:05am UTC](https://www.ruby-forum.com/t/sessions-draggable-element/143310/1 "2008-07-17T08:05:23Z")

</div>

Hi

I am doing draggable element with sessions. But sessions are new to  
me. I have a draggable\_element which should be dragged to the cart. I  
have defined action add for receving element. How I can delivery  
variable or text to the receving element

So my view goes :

TEST DRAGGABLE

 \<%= draggable\_element "param1", :revert =\> true%\>

 \<%= render :partial =\> "cart"%\> 

 Params are updating... 

\<%= drop\_receiving\_element “cart”,  
:update =\> “drop\_params”,  
:url =\> {:action =\> “add”},  
:accept =\> “params”,  
:hoverclass =\> “cart-active”,  
:loading =\> “Element.show(‘indicator’)”,  
:complete =\> “Element.hide(‘indicator’)”%\>

Contoroller goes :

In controller I have no idea what I should do. I have done few  
sessions with php, but not with rails.

def index  
session[:pipe] ||= {}

end  
def add

```
render :partial => "cart"

```

end

Partial cart goes:  
\<% session[:pipe].each do [param]%\>

\<% end %\>

I priciate for your help

---

<div class="post-metadata">

**Author:** ![torso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/34f0e0/32.png) [@torso](https://www.ruby-forum.com/u/torso)\
**Post date:** [July 17, 2008, 10:41am UTC](https://www.ruby-forum.com/t/sessions-draggable-element/143310/2 "2008-07-17T10:41:07Z")

</div>

drop\_receiving (like most other js helpers of that type)  
has a option :with, which allows to add additional information  
to the call

:with - A JavaScript expression specifying the parameters for  
the XMLHttpRequest. Any expressions should return a valid URL query  
string.

In the controller you just store the information you received  
You can do that in the session (which basically is just a hash)  
or in a db table.

---

<div class="post-metadata">

**Author:** ![torso](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/34f0e0/32.png) [@torso](https://www.ruby-forum.com/u/torso)\
**Post date:** [July 17, 2008, 1:36pm UTC](https://www.ruby-forum.com/t/sessions-draggable-element/143310/3 "2008-07-17T13:36:17Z")

</div>

I didn’t get it work. Can you give me a sample for function :with, how  
I can store information.
