-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
ActionText detection in app/assets/javascripts/rails_admin/application.js.erb produces false positives #3659
Comments
Just remove what you don't need. I suppose you're already accustomed to modify auto-generated codes, like ones generated by |
Hi @mshibuya, what auto-generated code are you referring to in your comment? When you say "Just remove what you don't need.", what are you suggesting I remove? This issue is coming from the interactions of two gems outside my control -- one being railsadmin due to its sub-optimal feature detection of If you still believe the issue lies within my own project, can you provide more detail? I'm certainly happy to make adjustments there. |
Ah sorry my bad, please ignore above. I mistook it as a template erb for the generator. Then I agree that having something better is desirable. I'll see if it is possible soon. |
Here is an example application that demonstrates the error: https://github.com/jdufresne/rails-example-action-text-issue To experience the error, run:
Deleting out RailAdmin's |
I'm trying to think of a use-case where one would load One possible solution would be to provide a global Rails Admin config option to actively disable Nevertheless, eagerly requiring I'm curious if someone has an idea on how to handle optional dependencies like this cleanly. |
I agree and I've opened an issue with that project at: bootstrap-ruby/bootstrap_form#719 I have also opened this issue in RailsAdmin to see if there is a more robust way to detect an enabled engine than |
Describe the bug
In
app/assets/javascripts/rails_admin/application.js.erb
, there is detection for the use of ActionText:rails_admin/app/assets/javascripts/rails_admin/application.js.erb
Lines 27 to 30 in 13c90fd
This checks if the
ActionText
module exists by callingdefined?
.My application does not use ActionText, but the ActionText module exists for other reasons. For me, this gets loaded by
bootstrap_form
gem, which uses the ERB helpers only:https://github.com/bootstrap-ruby/bootstrap_form/blob/ed3eda885c2145a364e8affd759f42b03ff6ee7c/lib/bootstrap_form.rb#L1-L9
When Rails bootstrap_form loads the global module
ActionText
for its helpers, it "tricks" railsadmin into believing ActionText is in use, which causes and issue when compiling assets:Reproduction steps
config/application.rb
to notrequire "action_text/engine"
bundle exec assets:precompile
Expected behavior
Assets are compiled and the ActionText dependencies are skipped.
Is there a more robust approach to detecting ActionText was loaded?
Additional context
rails
version: 7.1.2rails_admin
version: 3.1.2rails_admin
npm package version: n/aThe text was updated successfully, but these errors were encountered: