[newb] Controller Help

Hey all been working on my first app that is to help track projects and who's working on them. I want to be able in the project controller find employees in the employee controller by project_id, and then list them on my show defenition.

I thought this would work but ofcourse it doesn't and I can't find any examples in my google searches.

def show                 @project = Project.find(params[:id])                 @employees = Employee.find(params[:project_id]) end

If I change the @employees to Employee.find(:all) it will just list all employees even if they don't associate with the project.

any help would be teriffic!

Have a look at the rails guide on active record associations (assuming you have already worked through the getting started guide. I imagine that you want a has_and_belongs_to_many association between project and employees. Once you set this up then if you have a project in @project then @project.employees will give you an array of employees working on the project. Similarly if you have an employee then @employee.projects will tell you the projects he/she is working on. Such is the magic of rails.

Colin