Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6015689
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:52:20+00:00 2026-05-23T02:52:20+00:00

I followed several tutorial to make this work, but I can’t get draggable items.

  • 0

I followed several tutorial to make this work, but I can’t get draggable items.
Here’s what i did:

added gem 'acts_as_list' in my GemFile and did a bundle install

added <%= javascript_include_tag :defaults %> to my application.html.erb

added an :integer column named position to my facilities;

added acts_as_list in my facility model;

added the sort method in my facility model:

 def sort
   @facilities = Facility.all
   @facilities.each do |f|
     f.position = params['f'].index(f.id.to_s) + 1
     f.save
   end
 end

added this in my view:

<ul id="facilities">
<% for facility in Facility.all %>
  <% content_tag_for :li, facility do %>
    <span class="handle">[drag]</span>
    <%= link_to h(facility.name), facility %>
  <% end %>
<% end %>
</ul>
<%= sortable_element("facilities", :url => sort_facilities_path, :handle => "handle") %>

added this to the routes:

  resources :facilities do  
    collection do  
      post :sort  
    end  
  end

But in the end i have only a normal list, not draggable!
What am i missing?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:52:21+00:00Added an answer on May 23, 2026 at 2:52 am

    As far as I remember does acts_as_list only deal with lists in Rails’ models which means the server side of things. In order to make a list element draggable you’ll have to include a client side library or plugin such as jQuery UI. The gem itself doesn’t (or at least didn’t use to) include the functionality you’re describing.

    This library or solution will then

    1. make your elements draggable and
    2. provide you with a callback to update the order in the DB (usually using an AJAX call)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've followed this otherwise excellent tutorial on getting Xen working with Ubuntu but am
I followed this tutorial on configuring the Rails plugin ExceptionNotifier. I know that I
I've followed this example: RCP+JavaWS but the app just briefly comes up and goes
I followed this tutorial : http://blog.mugunthkumar.com/coding/iphone-tutorial-how-to-send-in-app-sms/ and I got the alert 'Text messaging is
I followed this tutorial with only one difference. Instead of naming it hello.php, I
I followed the instruction in this blog to add ScrollIntoView to ItemsControl . But
I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get
I have followed the suggestion in this question... [ How to handle checkboxes in
I followed the example SSO on Facebook's developer website but am getting a strange
Program followed by output. Someone please explain to me why 10,000,000 milliseconds from Jan

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.