ruby on rails 3 - Why include? gives me wrong results in Rails3? -


i guess i'm doing wrong... i've got 2 models in rails3:

  • user
  • container

each container has multiple users , need test whether specific user belongs specific container.

user.rb

has_many :user_containers has_many :containers, :through => :user_containers 

container.rb

has_many :user_containers has_many :users, :through => :user_containers 

i wrote helper should test user's "membership", returns false:

 def allow_access?(container, user)    container.users.include?(user)  end 

however, running in rails console just

container.users.include?(user) 

returns correctly true... missing something?

thanks


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -