# Acts\_as\_list issue

**URL:** <https://www.ruby-forum.com/t/acts-as-list-issue/152096>\
**Category:** Rails\
**Created:** [October 30, 2008, 4:24am UTC](https://www.ruby-forum.com/t/acts-as-list-issue/152096 "2008-10-30T04:24:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tankow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tankow](https://www.ruby-forum.com/u/tankow)\
**Post date:** [October 30, 2008, 4:24am UTC](https://www.ruby-forum.com/t/acts-as-list-issue/152096/1 "2008-10-30T04:24:30Z")

</div>

The list i have defined in my acts\_as\_list will not let me drag the li  
elements around. I am using FF, but IE6 also fails. Here is what i  
have defined in my code:

model: listing.rb

class Listing \< ActiveRecord::Base  
acts\_as\_list  
end

view: index.rb

# Listing listings

\<% for listing in @listings %\>

- \<%=h listing.name %\> \<%=h listing.completed\_dt %\> \<%=h listing.position %\> 
\<% end %\>

\<% sortable\_element ‘item\_list’, :url =\> { :action =\> “sort” }  
%\>

  

\<%= link\_to ‘New listing’, new\_listing\_path %\>

controller: listings\_controller.rb

…  
def sort  
params[:item\_list].each\_index do |i|  
item = Listing.find(params[:item\_list][i])  
item.position = i  
item.save  
end  
@list = Listing.find(:all, :order =\> ‘position’)  
render :layout =\> false, :action =\> :index  
end

I also have all of the javascript includes in the layout and can see  
them when i view source of the page.

What am i missing? or what is wrong with the code?

Thanks  
Phil

---

<div class="post-metadata">

**Author:** ![tankow](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/5e9695/32.png) [@tankow](https://www.ruby-forum.com/u/tankow)\
**Post date:** [November 2, 2008, 3:33am UTC](https://www.ruby-forum.com/t/acts-as-list-issue/152096/2 "2008-11-02T03:33:21Z")

</div>

problem was the invalidauthenticitytoken
