search for: move_up

Displaying 2 results from an estimated 2 matches for "move_up".

Did you mean: move_p
2006 Feb 09
1
How to reorder rows in a table?
Hi, I have a link table with a location field, here is the code I wrote to reorder the rows # move_up action in links controller def move_up current_link = Link.find(params[:id]) current_link.location -= 1 current_link.save same_link = Link.find_by_location(current_link.location) same_link.location += 1 same_link.save redirect_to :action => ''list''...
2005 Nov 25
2
acts_as_list with 2 fields in the scope
...e. I want it to act as a list within the scope of the parent_id AND the site_id. Categories table : id label site_id parent_id So, in my Category class, I have : acts_as_list :scope => ''site_id = #{site_id} AND parent_id = # {parent_id}'' The problem is that when I try to move_up a Category with a parent_id that is null, the generated query (found in my development.log) is "SELECT * FROM categories WHERE (site_id = 1 AND parent_id = AND position = 3)" which gives me an error (because of "parent_id = AND"). So, my question is "how can I solve t...