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

Add activestorage.rbi #108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

connorshea
Copy link
Contributor

Type of Change

  • Add RBI for a new gem
  • Modify RBI for an existing gem
  • Other:

Changes

Various methods were not being handled correctly (e.g. variant) for Rails models that were using ActiveStorage. This fixes many of those issues.

@connorshea connorshea requested a review from a team as a code owner September 18, 2022 16:25
Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

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

Can you update the index?

Various methods were not being handled correctly (e.g. `variant?`) for
Rails models that were using ActiveStorage. This fixes many of those
issues.
And update index.json as well.
@connorshea
Copy link
Contributor Author

Updated index.json and I think I've got the checks passing now, after running them locally.

"rails"
],
"requires": [
"rails",
Copy link
Contributor

Choose a reason for hiding this comment

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

Did it fail without rails dependency and require?

Copy link
Member

Choose a reason for hiding this comment

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

It should not. Active Storage doesn't depend on Rails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since ActiveStorage::Blob/ActiveStorage::Attachment are technically models, it needs to load the ActiveStorage engine, and the engine failed to load until rails was added as a dependency. Is there a smaller dependency I can use to get the engine to work?

Choose a reason for hiding this comment

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

The problem seems to be there is a require "rails" dependency in ActiveStorage, but it's not declared as a dependency in the gemspec. Same goes for Action Cable, Action Mailbox and Action Text.

"rails"
],
"requires": [
"rails",
Copy link
Member

Choose a reason for hiding this comment

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

It should not. Active Storage doesn't depend on Rails.

Comment on lines +28 to +32
"dependencies": [
"rails"
],
"requires": [
"rails",

Choose a reason for hiding this comment

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

My previous comment was not correct, this work locally without upstream changes:

Suggested change
"dependencies": [
"rails"
],
"requires": [
"rails",
"dependencies": [
"railties"
],
"requires": [

Rails contains a single file and dependencies on all gems (including Railties), Railties has what we actually need.

@Morriar Morriar added the rbi Change related to RBI annotations label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rbi Change related to RBI annotations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants