I’m following this tutorial – http://communityguides.heroku.com/articles/9 -app/controllers/admin_controller.rb
Stuck on a “can’t convert nil into String” error with the following block of code.
# freeze state
@article.freezebody = @article.title + "\n\n" + @article.teaser + "\n\n" + @article.body + "\n\n" + @article.version + "\n\n" + @article.changelog
@article.accepted = Time.now
Is this a regex issue? I don’t even know where to start.
One ore more of your attributes is
nil, and this:will give you the exception you’re seeing.
To concatenate those attributes, minus any that might be nil (shortened for readibility):
compactremoves allnilobjects from the array.