Drop_receiving_element does not fire

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs