Open fugakkbn opened 1 year ago
In ~/.rbenv/versions/3.0.4/lib/ruby/3.0.0/erb.rb
, @src
is passed as the first argument of eval
at line 905. This reads the file passed to the load_and_set_settings
method. It calls the Rails object in @src
.
The uninitialized constant Rails (NameError)
at the beginning of the error message seems to occur here.
In other words, the file is successfully passed from the Rails project. If we can handle Rails objects in the gem, the problem is solved.
No. Is it really so? It's possible that the Rails object could be read after being converted.
Need to see how the Settings object is generated in a real Rails project
Hmmm, it seems that @src
is read as a Rails object even in the process of loading it in the Rails project.
Maybe we still need to allow the gem to run in the context of Rails on the gem side.
Or how about passing the Settings object directly? No need to re-generate what we originally have in our Rails project.
Is there any way to pass objects from Rails to gem?
We get an error when we run it on a Rails project.
I can see from the log that when the
load_and_set_settings
method of the config gem is called, it tries to run in the context of Rails. However, this gem does not have Rails installed, so it appears to be an error.