app/models/section.rb
# orders articles assigned to this section
orders articles assigned to this section
orders articles assigned to this section
def order!(*sorted_ids)
    transaction do
      sorted_ids.flatten.each_with_index do |article, pos|
        assigned_sections.detect { |s| s.article_id.to_s == article.to_s }.update_attributes(:position => pos)
      end
      save
    end
  end
def order! ( * sorted_ids ) transaction do sorted_ids . flatten . each_with_index do | article , pos | assigned_sections . detect { | s | s . article_id . to_s == article . to_s } . update_attributes ( :position => pos ) end save end end
orders articles assigned to this section
orders articles assigned to this section
sorted_ids
<not_specific>