Chang Sau S. wrote:
Just at the top of my head, I think it would be simpler if you add a
method in your employee model that determines if the employee is related
to the project or not:
if self.projects.contains? project then
I suppose this can be done in a cleverer way somehow but this should
James W. wrote:
employees not in the project
Each employee would have a checkbox after there name. That check box
would be checked if they had an association to the current project.
If they did not then the checkbox would be unchecked.
Checking the box (or unchecking ) would the add or remove the
association to that project.
Sounds good to me, I never thought of adding something like this into
the model. All this MVC i’m still learning.
However taking what you have here I get an error of:
undefined method `contains?’ for Project:Class
I cannot seem to find the contains? method in the API reference
anywhere.Is it a ruby method? Googling contains? reveals nothing.