turingschool / curriculum

Turing's main repository of tutorials and projects
385 stars 502 forks source link

nomethoderror undefined method `name' for nil:nilclass due to ActiveRecord bug #1170

Open jeanmerlet opened 8 years ago

jeanmerlet commented 8 years ago

This may be restricted to Fedora users, but the combination of Ruby 2.2 and Rails 4.0.0 raised the "nomethoderror undefined method `name' for nil:nilclass" in this tutorial for me when adding "@articles.comments.size" to the h3 comment header in the comments section of the Blogger tutorial. As explained here, this is due to an ActiveRecord bug that is fixed with earlier Ruby versions or later Rails versions. I managed to fix the problem by upgrading to Rails 4.1.2. Obviously changing the suggested Rails version just because of this is probably not the best solution, but maybe a side note should be inserted? The SO solution is here, which was opened by me.