# Drop\_receiving\_element does not fire

**URL:** <https://www.ruby-forum.com/t/drop-receiving-element-does-not-fire/194514>\
**Category:** Rails\
**Created:** [September 6, 2010, 4:39pm UTC](https://www.ruby-forum.com/t/drop-receiving-element-does-not-fire/194514 "2010-09-06T16:39:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nktokyo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/3d9bf3/32.png) [@nktokyo](https://www.ruby-forum.com/u/nktokyo)\
**Post date:** [September 6, 2010, 4:39pm UTC](https://www.ruby-forum.com/t/drop-receiving-element-does-not-fire/194514/1 "2010-09-06T16:39:55Z")

</div>

I am trying drag and drop in RoR for the first time.

What I want to achieve, is a list of slots, and a list of entries. You  
should be able to drag an entry onto a slot and slot.entry\_id will  
update to match the dragged entry.entry\_id.

I’ve spent a lot of time looking in textbooks and online, but cannot  
get the drop\_receiving\_element to fire. When I release an item over  
the slot, the item simply reverts. If someone could look through the  
code I’ve pasted and gave a hint I would appreciate it.

1. Here is the VIEW for the page:

\<% f.fields\_for :slots do |builder| %\>  
\<% element\_to\_drop\_id = “slot” %\>

 \<%= builder.label :slot\_number, "Slot Num" %\> \<%= builder.text\_field :slot\_number %\> \<%= builder.label :entry\_id, "Entry Num" %\> \<%= builder.text\_field :entry\_id %\> 
 \<%= drop\_receiving\_element("slot", :accept =\> "entry", :hoverclass =\> 'hover', :with =\> "'entry=' + (element.id.split('\_').last())", :slot\_id =\> :slot\_id, :url =\> {:action =\> :set\_entry} ) %\>

\<% end %\>

 \<%= render :partial =\> "entry\_list\_for\_drag" %\> 

1. Here is the partial entry\_list\_for\_drag

\<% @entries.each do |entry| -%\>  
\<% element\_to\_drag\_id = “entry\_#{entry.id}” %\>

 style="cursor:move"\> 

\<%= entry.title %\> \<%= entry.body %\>

 \<%= draggable\_element(element\_to\_drag\_id, :revert =\> true) %\> \<% end %\>
1. Entries and slots exist on pages. In the page controller I’m  
starting to set up the below but I can’t even get this to trigger

def set\_entry  
@slot = Slot.find(params[:slot\_id])  
entry\_id = params[:entry]  
@slot.entry\_id = entry\_id  
end
