Comments (10)
Possibly related? SchemaPlus/schema_plus#42
from strongbox.
I'm not seeing this with Rails 3.2.3 and Ruby 1.9.2. What versions are you using? What other gems have you added to your app?
Thanks.
from strongbox.
Rails 3.2.2 / Ruby 1.9.3.
Looks like I have found the problem, I had an initializer that chained ActiveRecord::ConnectionAdapters::Mysql2Adapter#configure_connection to add some additional functionality. Removing that fixes the problem.
Adding this below will reproduce the issue:
if defined?(ActiveRecord::ConnectionAdapters::Mysql2Adapter)
class ActiveRecord::ConnectionAdapters::Mysql2Adapter
def configure_connection_with_test()
configure_connection_without_test()
end
alias_method_chain :configure_connection, :test
end
end
from strongbox.
Hmm, still not able to reproduce this. If you start a clean project with just the above and strongbox, do you get the same error?
from strongbox.
So sorry, forgot to add an important piece of information. The file is included in the config.after_initialize block.
Yes, I was able to reproduce with a clean project.
from strongbox.
I tried 1.9.2/3.2.2 and still can't reproduce it. Can you throw the minimum project that fails for you in a repo?
from strongbox.
Sorry for the delay, here you go: https://github.com/carsonreinke/strongbox-test
from strongbox.
config/initializers/mysql_test.rb is getting loaded twice first automatically by rails the initialization and then explicitly by you in config.after_initialize
.
Without Strongbox it works because when Rails loads the initialization file ActiveRecord::ConnectionAdapters::Mysql2Adapter
isn't defined, but it is when you load the file.
With Strongbox ActiveRecord::ConnectionAdapters::Mysql2Adapter
is loaded when Rails first loads the file. This cause two calls to alias_method_chain
which creates the loop.
I assume this happens because Strongbox's call to ActiveRecord::Base.send
causes Rails lazy loading to pull in that class sooner.
So, it's not a bug in Strongbox, just a question the gem effecting when the class is loaded. Two way to work with that:
- Move the initializer code out of the initializers directory so it's only loaded once.
- Make sure
alias_method_chain
can only be called once:
unless method_defined? :configure_connection_with_time_zone
alias_method_chain :configure_connection, :time_zone
end
from strongbox.
Ah, good call. Sorry for the bother.
from strongbox.
No worries, it's a pretty subtle issue.
from strongbox.
Related Issues (20)
- Cannot visit Strongbox::Lock - error HOT 4
- dynamic :public_key and :private_key HOT 4
- Encoding::CompatibilityError HOT 1
- Allow empty encryption field HOT 2
- Tags for Releases HOT 2
- Per-Compnay encryption settings
- Travis-CI HOT 3
- Using strongbox with NSS HOT 1
- Format validations failing HOT 1
- Ciphertexts are unauthenticated HOT 6
- Default PKCS#1 v1.5 padding leaks information
- How to avoid storing private key by re-generating it HOT 1
- Decrypt Data Offline HOT 3
- Validation before encryption? HOT 3
- string contains null byte HOT 2
- Changelog HOT 1
- OpenSSL::PKey::RSAError: padding check failed
- Validate uniqueness is possible? HOT 3
- Current state of this gem HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strongbox.