Acts_as_list - new items

Hello all,

I’m using acts_as_list for an application, and is mostly working fine,
however I seem to have come across a problem.

If I use the following method -

def add_month

@client = Client.find(params[:id])
@client.client_months.create()

@client_months = ClientMonth.find_all_by_client_id(params[:id])
@client_months.first.move_to_bottom

render :text => "#{@client_months.last.id}"

end

what I am doing is creating a new item, which should place it at the
bottom of the list and then I want to move the first item in the list
to the end. The code seems to be working, however the render :text line
seems to be showing the item I added to the list as being the last
item, rather than the item I subsequently moved to the bottom, which is
what I expected it to return.

Does anyone have any suggestions why this might be happening?

Thanks,

Alastair

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