|
|
@ -288,7 +288,7 @@ class CoursesController < ApplicationController
|
|
|
|
inform = @course.informs.find_by(id: params[:inform_id])
|
|
|
|
inform = @course.informs.find_by(id: params[:inform_id])
|
|
|
|
next_inform = inform.next_inform
|
|
|
|
next_inform = inform.next_inform
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
if next_inform
|
|
|
|
if next_inform.blank?
|
|
|
|
render_error('已经到达最顶部')
|
|
|
|
render_error('已经到达最顶部')
|
|
|
|
else
|
|
|
|
else
|
|
|
|
inform.update_attribute(:position, (position + 1))
|
|
|
|
inform.update_attribute(:position, (position + 1))
|
|
|
@ -302,7 +302,7 @@ class CoursesController < ApplicationController
|
|
|
|
inform = @course.informs.find_by(id: params[:inform_id])
|
|
|
|
inform = @course.informs.find_by(id: params[:inform_id])
|
|
|
|
last_inform = inform.last_inform
|
|
|
|
last_inform = inform.last_inform
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
if last_inform
|
|
|
|
if last_inform.blank?
|
|
|
|
render_error('已经到达最底部')
|
|
|
|
render_error('已经到达最底部')
|
|
|
|
else
|
|
|
|
else
|
|
|
|
inform.update_attribute(:position, (position - 1))
|
|
|
|
inform.update_attribute(:position, (position - 1))
|
|
|
|