无论我多么努力,我都无法说服这里的其他人这样的代码是多么糟糕和错误。一些评论会很好。
def addStudentToClass
ActiveRecord::Base.connection.insert("INSERT INTO student_class (student_id, class_id, creator_id, created_at) VALUES (#{params[:student_id]}, #{params[:class_id]}, (SELECT creator_id FROM classes WHERE class_id = #{params[:class_id]}), NOW())")
usrObj = User.find(params[:student_id]).load_goal_structures();
render json: nil
end
任何建设性的意见将不胜感激。