ruby on rails - Nomethod Error in TakeAssementController#start -


undefined method 'id' nil:nilclass extracted source around line 42.

this part of take_assement.controller.rb file showing error. line started line 36. accordingly line 42 has issue.

def start if current_user.taken_any_assessment?.all?   redirect_to user_root_path else   portal.all.sort_by(&:display_order).each |portal|     if !current_user.taken_assessment (portal.current_assessment(current_user))       @assessment =       assessment.find(portal.current_assessment(current_user).id)       if !@assessment.has_student_taken_this_assessment?(current_user)         assessmentresult.create!(student: current_user, assessment: @assessment, last_question: 0)         @question = @assessment.questions.first       else         last_position = assessmentresult.where(student: current_user, assessment: @assessment).first         @question = @assessment.questions.where(position: last_position.last_question+1).first       end 


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -