-
-
Notifications
You must be signed in to change notification settings - Fork 262
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
fix: eject generator failing due to undefined source_location method #3566
fix: eject generator failing due to undefined source_location method #3566
Conversation
Code Climate has analyzed commit fc70f6d and detected 0 issues on this pull request. View more on Code Climate. |
Hi @Eddayy, thanks for submitting this. Could you please specify which component failed to eject and provide the Rails/Ruby version used? |
Sorry i didn't include it, here are the details |
Thanks for sharing @Eddayy It's not failing on my side, any tip on how to reproduce it? ╭─bob@machine ~/Projects/gems/avo/spec/dummy ‹main●›
╰─$ ruby -v & rails -v & bin/rails g avo:eject --component Avo::Views::ResourceIndexComponent
[1] 17013
[2] 17014
ruby 3.3.5 (2024-09-03 revision ef084cc8f4) [x86_64-linux]
[1] - 17013 done ruby -v
Rails 7.1.2
[2] + 17014 done rails -v
warning: parser/current is loading parser/ruby33, which recognizes 3.3.6-compliant syntax, but you are running 3.3.5.
Please see https://github.com/whitequark/parser#compatibility-with-ruby-mri.
Running via Spring preloader in process 17107
Avo community 3.15.7
By ejecting the 'Avo::Views::ResourceIndexComponent' you'll take on the responsibility for maintain it.
Are you sure you want to eject the 'Avo::Views::ResourceIndexComponent'? [y/N] y
create app/components/avo/views/resource_index_component.rb
create app/components/avo/views/resource_index_component.html.erb |
@Paul-Bob, turn out I'm having the issue because when installing avo on a new rails app, it install a newer Related PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this contribution @Eddayy!
Description
Ejecting components now fails with source_location undefined error, this is because it's used on the class directly while it's supposed to be used on methods
https://ruby-doc.org/3.3.6/Method.html#method-i-source_location
Fixes # (issue)
Will use
const_source_location
instead to find the classChecklist:
Screenshots & recording
Manual review steps
Manual reviewer: please leave a comment with output from the test if that's the case.