ruby on rails - Circular dependency when trying to reopen an engine class? -
ruby on rails - Circular dependency when trying to reopen an engine class? -
i trying re-open class in rails comes engine. did following:
module xaaron apikey.class_eval include promiscuous::publisher publish :xaaron_users_id, :api_key, :as => :apikey end end
which sits in:
models/ xaaron/ api_key.rb
this in app, should allow me run:
bundle exec promiscuous publish "xaaron::apikey.all"
but, when do, error:
runtimeerror: circular dependency detected while autoloading constant xaaron::apikey
tl;dr: seek renaming api_key.rb
else.
here i think happening: rails autoloader loads xaaron/api_key.rb
, encounters unknown constant xaaron::apikey
. tries load file called (based on constant name)... xaaron/api_key.rb
. boom, circular dependency.
ruby-on-rails ruby class-eval
Comments
Post a Comment