search for: reorder_positions

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

2006 Apr 01
3
acts_as_list with scope : position update problem?
...igure out what''s wrong. class Person < ActiveRecord::Base belongs_to :family, :order => ''position'' acts_as_list :scope => ''family_id'' validates_uniqueness_of :position, :scope => ''family_id'' before_validation_on_update :reorder_positions private def reorder_positions @updated_family_id = params[:person][:family_id] unless @updated_family_id == self.family_id self.move_to_bottom # reorder original list params[:person][:family_id] = Family.find_by_id(@updated_family_id).people.length + 1 end end end When I update a...
2006 Mar 23
1
handle multiple lists: move an item from one list to another
How do I manage multiple lists? This is what I need. Sometimes an item needs to be moved from one list to another. class Item < ActiveRecord::Base belongs_to :group acts_as_list :scope => :group end class Group < ActiveRecord::Base has_many :items, :order => "position" end Now, sometimes, I may need to change an item from one group to another. But when I do that,