Project (id)
Permission (project_id, user_id)
When user’s create a project, I want to ensure that a group can not be created without there being at least one permission (1 or more).
Is there a way to add this validates to the Project model?
UPDATE
project controller
@project = current_user.projects.new(:name => params[:project][:name])
@project.permissions.build(:user_id => current_user.id)
respond_to do |format|
if @group.save
......
I’m assuming that your Project model has_many permissions, in which case, you can do the following: