. , , .
, .
, :
index params[:project_id], .create - , , .update , , .destroy - , , .- ,
show edit, index.
, . , projects_users - join_table, has_and_belongs_to_many. ( has_many through:), , - . , , ( ).
project_participation?
, .
1) , : - , , , () .
. , , , .
2) User#role_for(project), , , user project.
- :
@user.project_participations.where(project_id: @project.id).first.try(:role)
ProjectParticipation.find_by(project_id: @project.id, user_id: @user.id).try(:role)
, ( ) .
3) . , (has_and_belongs_to_many), , (has_many through:).
: , ? , - , , . , , (, ), (), .