-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Where to put ConsistencyFail::Enforcer.enforce! #9
Comments
I wouldn't turn the Enforcer on in production, personally. It's extremely invasive. The quick-n-nasty hack option would be to wrap that in an There are a number of other options to load code during Rails startup, many of which are outlined in the Rails guide on configuration. I'd suggest taking a look there if you're looking for something different than the above options. I'm also happy to take a docs pull request to clarify this. Let me know if this helps. |
@trptcolin thanks for you answer. Indeed, I wasn’t considering for production, but again I couldn’t make it work in Checking Specifically for the original issue that I opened I cannot use an initializer, because in my case I get a I would still wait for some other suggestion of yours, but meanwhile how do you feel about this?
Rails.application.config.after_initialize do
if Rails.env.development?
require 'consistency_fail/enforcer'
ConsistencyFail::Enforcer.enforce!
end
end |
That solution seems fine to me. |
👍 |
Hi,
perhaps similar to #2, as per the updated README, I put…
… in
config/environments/development.rb
at first, but then I get an error:… without going into specifics of the above log, we could say that
ConsistencyFail::Enforcer
will load prior todevise
in this case (or any other gem for that matter).So, I moved
enforce!
check into theconfig/environment.rb
and suddenly things seem to work for me.But then I am not sure if is this okay for production environment, since
consistency_fail
is available/installed only in development group inGemfile
.Any ideas/comments please? Thank you.
The text was updated successfully, but these errors were encountered: