So, the problem is, if I try to do
Task.find_all_by_project_id(u.projects) it doesnt work, but this
Task.find_all_by_project_id(u.projects.collect{|p| p.id}) works.
Task.find_all_by_project_id(u.projects) it doesnt work, but this
projects contains an array with hashes which looks like:
[{:id => 1, :name => ‘me’}, {:id => 2, :name => ‘you’}]
rails can’t know which key in the hash to use (ok, it could be
nice and default to id…)
Actually, i think rails know wich one is the key, because the generated
query is:
“SELECT * FROM tasks WHERE (tasks.project_id = 3,4)”
Rails got the right key, but he can’t identify thats an array, i think.
Regards,
Rafael Mueller
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.