Params(:id) overwritten

So when creating draggable objects it seems to pass the id through
params. The problem is I need the param id from the url. Is there
anyways I can manually get the url id from my controller class or a way
to change draggable to not look for “id”. Draggable_element seems too
look for the id tag in the list (<li
id=‘ingredient_<%=ingredient.id%>’). Once in the controller I need the
url id variable as well as the draggable id. Hope that made sense.

Here is the code. Thanks I am very new to this.

<% for ingredient in @all_ingredients%>

  • <% if ingredient.photos.size > 0 %>
    <% main_photo= ingredient.photos.find(:first) %>
    <%= link_to(image_tag(“ingredients/”+main_photo.name,
    :size =>‘25x25’,
    :border => 1,
    :id =>“photo_#{main_photo.id}” ))
    %>

    <% end %>

    <%= ingredient.name %>

  • <%= draggable_element “ingredient_#{ingredient.id}” , :revert => true %>

    When I check my params[:id] in my controller I get the ingredient_3
    instead of whats in the url (e.g. 1)

    Thanks!

    From what I’ve read it seems like the draggable method should not use ID
    (but it does) because the ID field is special to rails. Not sure what to
    do with this.

    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