RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: bunswo
I have an odd case where my code created with the help of this rails casts for HABTM checkboxes was working fine... an then all of a sudden I'm getting a NoMethodError: undefined method `name' for nil:NilClass error when creating or updating a record that has project_ids filled in.
If I try to use the method in the rails console I get the error specifically at the point of adding project_id's like this:
p = Project.last
works and returns project field data
p.person_ids = [1,2]
And the weird part is, that once that all happens, if I call p.save after the errors list, it actually saves properly adding the two people assignments to the project
I've rolled back the git history to see if I did something else, but even if I go way back to previous versions that worked for sure it still gives the same error. This makes me think it's database related??