|
|
|
@ -289,7 +289,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
next_inform = inform.next_inform
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
if next_inform
|
|
|
|
|
render_error('已经到达最底部')
|
|
|
|
|
render_error('已经到达最顶部')
|
|
|
|
|
else
|
|
|
|
|
inform.update_attribute(:position, (position + 1))
|
|
|
|
|
next_inform.update_attribute(:position, last_inform.position - 1)
|
|
|
|
@ -303,7 +303,7 @@ class CoursesController < ApplicationController
|
|
|
|
|
last_inform = inform.last_inform
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
if last_inform
|
|
|
|
|
render_error('已经到达最顶部')
|
|
|
|
|
render_error('已经到达最底部')
|
|
|
|
|
else
|
|
|
|
|
inform.update_attribute(:position, (position - 1))
|
|
|
|
|
last_inform.update_attribute(:position, last_inform.position + 1)
|
|
|
|
|