From: Rick Armstrong Date: 2006-10-10T05:17:26+09:00 Subject: Stupid TypeError while checking array values Not sure if I'm even close to the mark on this. Ruby noob here...RACKIN M'BRAINS HERE!! :( I am trying to check values of an array against another value. Unfortunately, I keep getting a TypeError that says: can't convert User into Integer I am trying to check if a logged in user has access to a course id based on ownership assignments. I have 2 tables having M:M relationship and a join table: **************** * * * Courses * * * **************** ********************** * * * Courses_Users * * * ********************** **************** * * * Users * * * **************** ...and here is my action def user_assigned_course(course_id, user_id) allowed_users = Course.find_by_id(course_id).users allowed_users.each do |user| if allowed_users[user] == user_id return true end end end ...help... -- Posted via http://www.ruby-forum.com/.