Skip to content
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

rescue instead if actiontext could not be found #706

Merged

Conversation

BenMorganMY
Copy link
Contributor

No description provided.

Copy link
Contributor

@lcreid lcreid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this suggestion! It makes a lot of sense to me. We really appreciate everyone's efforts to make the gem better. I had one question before we merge this PR.

require "#{Gem::Specification.find_by_name('actiontext').gem_dir}/app/helpers/action_text/tag_helper"
rescue Gem::MissingSpecError
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why this is a better solution. I wonder if it would be worthwhile writing an error message in the rescue case. It might be better than silently swallowing the error. (Admittedly this could also be said of the current code.) What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would mean that any application that is loaded without actiontext would always get an error message. It might be more useful to put error handling when the user attempts to use the action text tag helper.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course. Good point. And when they try to use the action text helper, they'll get a obvious (by Rails standards, at least) error message. Thanks for walking me through the thinking!

@lcreid
Copy link
Contributor

lcreid commented Oct 2, 2023

You can ignore the failures against edge Rails, but please fix up the lint issue by ignoring the RuboCop warning.

@BenMorganMY
Copy link
Contributor Author

@lcreid done!

Copy link
Contributor

@lcreid lcreid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for this PR!

@lcreid lcreid merged commit 4811ee4 into bootstrap-ruby:main Oct 5, 2023
8 of 11 checks passed
@BenMorganMY BenMorganMY deleted the auto-detect-if-actiontext-not-present branch October 5, 2023 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants