This repository has been archived by the owner. It is now read-only.

Unicorn NameError in Production #33

zackfern opened this Issue Sep 3, 2012 · 6 comments


None yet
5 participants

zackfern commented Sep 3, 2012

I feel as if this is probably my own fault and I'm just too stupid to notice, but I can't seem to get Strong Parameters to work in production using Unicorn.

The Unicorn workers won't start, failing with uninitialized constant ActiveModel::ForbiddenAttributesProtection (NameError)
I've attached the full log here.

I've got gem 'strong_parameters' in my Gemfile,
and I've got include ActiveModel::ForbiddenAttributesProtection in my model.

Everything works fine locally, and even if I load up the Rails console in Production. It's only when Unicorn tries to spawn that it fails.

Any help would be greatly appreciated.

Fustrate commented Nov 2, 2012

Did you ever find an answer to this? I'm running into the same problem, though I haven't started trying to solve it yet.

Update: rebooting the server solved the problem. Not sure why such a drastic action was necessary, but hey, whatever works.


rafaelfranca commented Nov 2, 2012

have you execute your unicorn using bundle exec?

Fustrate commented Nov 2, 2012

Yes. (Un)fortunately, this only happened on the first update after adding the strong parameters gem, so I'm not sure if I'd be able to add any more relevant information to this issue.

zackfern commented Nov 2, 2012

@Fustrate Unfortunately I didn't find an answer to this, I just stopped using Strong Parameters.

@rafaelfranca Honestly I can't remember.

iHiD commented May 15, 2013

@rafaelfranca I just hit this issue. I believe it is due to unicorn's restart (kill -s USR2) not updating the Gemfile that is used. I found this related PR that shows the error and a fix: sosedoff/capistrano-unicorn#2. This would also explain @Fustrate's experience of it only happening on restart.

In summary, I'm pretty certain it's not a strong_paramaters issue 👍

If you are using rails 4 then remove the strong_parameters initializer (or from your model) and gem 'strong_parameters' from your gemfile. Rails 4 comes with strong parameters enabled by default.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.