Em 06-07-2011 15:23, Jarrod Roberson escreveu:
I can't view one of my teams in Gitorious.
I get the following error:
NoMethodError (undefined method `project_id' for nil:NilClass):
app/models/group.rb:85:in `all_related_project_ids'
...
def all_related_project_ids
...
all_project_ids << committerships.map{|p| p.repository.project_id
} <===== this is the line where it is failing
...
end
Any idea how to debug this error?
This means that for some reason you have an instance of a committership
with repository_id null. That shouldn't happen when using ActiveRecord
itself for saving the records in database due to this validation:
validates_presence_of :committer_id, :committer_type, :repository_id
Rails (ActiveRecord actually) won't add such restriction to the database
only because a validation was created. Gitorious should add this
constraint on database too for avoiding situations like that.
You should take a look at your database and find the record with
repository_id = null and delete it or fix it. This would delete such
records:
delete from committerships where repository_id is null;
Marius, Christian, I think we should add a migration to add the "NOT
NULL" constraint to that column and the other ones in the same situation...
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]