diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-08 04:13:18 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-01-08 04:13:18 +0000 |
commit | 76110407b70e33d8bf1efdd7f731645a9009048d (patch) | |
tree | 0dff95ff8b38d53df4479eee81462cf17ccef907 /lib/plugins/acts_as_list | |
parent | 6dcfa742fded31c07101d9bea3122f49af83ea12 (diff) | |
download | redmine-76110407b70e33d8bf1efdd7f731645a9009048d.tar.gz redmine-76110407b70e33d8bf1efdd7f731645a9009048d.zip |
Rails4: replace deprecated Relation#update_all at acts_as_list
git-svn-id: http://svn.redmine.org/redmine/trunk@12504 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/plugins/acts_as_list')
-rw-r--r-- | lib/plugins/acts_as_list/lib/active_record/acts/list.rb | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/lib/plugins/acts_as_list/lib/active_record/acts/list.rb b/lib/plugins/acts_as_list/lib/active_record/acts/list.rb index 9361a768c..3c1ba5216 100644 --- a/lib/plugins/acts_as_list/lib/active_record/acts/list.rb +++ b/lib/plugins/acts_as_list/lib/active_record/acts/list.rb @@ -233,39 +233,39 @@ module ActiveRecord # This has the effect of moving all the higher items up one. def decrement_positions_on_higher_items(position) - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} <= #{position}" - ) + acts_as_list_class. + where("#{scope_condition} AND #{position_column} <= #{position}"). + update_all("#{position_column} = (#{position_column} - 1)") end # This has the effect of moving all the lower items up one. def decrement_positions_on_lower_items return unless in_list? - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} - 1)", "#{scope_condition} AND #{position_column} > #{send(position_column).to_i}" - ) + acts_as_list_class. + where("#{scope_condition} AND #{position_column} > #{send(position_column).to_i}"). + update_all("#{position_column} = (#{position_column} - 1)") end # This has the effect of moving all the higher items down one. def increment_positions_on_higher_items return unless in_list? - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} + 1)", "#{scope_condition} AND #{position_column} < #{send(position_column).to_i}" - ) + acts_as_list_class. + where("#{scope_condition} AND #{position_column} < #{send(position_column).to_i}"). + update_all("#{position_column} = (#{position_column} + 1)") end # This has the effect of moving all the lower items down one. def increment_positions_on_lower_items(position) - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} + 1)", "#{scope_condition} AND #{position_column} >= #{position}" - ) + acts_as_list_class. + where("#{scope_condition} AND #{position_column} >= #{position}"). + update_all("#{position_column} = (#{position_column} + 1)") end # Increments position (<tt>position_column</tt>) of all items in the list. def increment_positions_on_all_items - acts_as_list_class.update_all( - "#{position_column} = (#{position_column} + 1)", "#{scope_condition}" - ) + acts_as_list_class. + where("#{scope_condition}"). + update_all("#{position_column} = (#{position_column} + 1)") end def insert_at_position(position) |