Rick Armstrong wrote:
> Ooops: forgot to add ".id" after "allowed_users[user]"
>> 
>> ...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...
> 
>   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].id == user_id
>         return true
>       end
>     end
>   end

*ooops* *blush*

this worked:

  def user_assigned_course(course_id, user_id)
    allowed_users = Course.find_by_id(course_id).users
    for user in allowed_users
      if user.id == user_id
        return true
      end
    end
  end

-- 
Posted via http://www.ruby-forum.com/.