This is a tip that I’m writing in the hopes of helping Typo users who will google for the following error messages uninitialized constant ActionController::TestRequest or undefined method `publish!’ for nil:NilClass.
While publishing an article on db2onrails.com, I’ve selected a future publishing date for the post (just to round it off to the half an hour mark). I’ve performed this operation in the past without encountering any problems, but for some bizarre reason (most likely a Typo 4.0.3 bug) it didn’t work this time. The article wouldn’t show up and the /admin section would raise the typical Application Error (Rails). There was obviously some kind of issue with the application and the only reason why the homepage was working fine is because its content was cached.
At this point, I restarted fcgi, reloaded the homepage and boom: uninitialized constant ActionController::TestRequest. If you go to your PhpMyAdmin or access your database by any other means, you should drop the ‘offending’ article that you intended to publish (you can find it in the contents table). If you reload your application now, you should see another error: undefined method `publish!’ for nil:NilClass. This is due to the fact that in the table triggers there is a publishing action waiting to be executed on an article that no longer exists.
Please follow the instructions below as a quick fix to the problem, if you encountered these errors in Typo just after you did a post dated in the future:
- Drop the problematic article from the contents table. You should first take note of its id and make a copy of its body if you don’t have it already (as you are going to publish it again in a few moments).
- Drop the corresponding record from the triggers table. You’ll recognize the raw by the pending_item_id (which is the same number as the id for the record you just deleted in contents) and the trigger_method field set for publishing.
Your blog should be back up and you’ll be able to access the /admin section as well. You can now repost the initial message, just make sure not to set a future date and time again. 😉
Get more stuff like this
Subscribe to my mailing list to receive similar updates about programming.
Thank you for subscribing. Please check your email to confirm your subscription.
Something went wrong.