Coursemology/coursemology.org — pull request #181 by DIdiHL (2014-08-23 09:41:10+00:00)
Title: Undefined method levels

Fix this exception https://groups.google.com/forum/#!topic/coursemology/emUJJEohQ-Q
It is caused by a user, probably admin, trying to attempt an assessment of a course he's not enrolled. In this case, his UserCourse record can't be found so we were trying to access the levels property of nil.
Fixed by removing the attempt button if a user is not enrolled and redirect to the access denied page if he tries to access with url.