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

"Show DB Schema for Current Class" doesn't work #32

Open
yuchan opened this issue Dec 16, 2017 · 2 comments
Open

"Show DB Schema for Current Class" doesn't work #32

yuchan opened this issue Dec 16, 2017 · 2 comments

Comments

@yuchan
Copy link

yuchan commented Dec 16, 2017

screen shot 2017-12-16 at 23 05 14

TextMate version: 2.0-rc.4
Ruby version: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
Rails version: 5.1.4

I was looking into show_schema.rb and found ruby18. Then, I tried changing it to ruby, but it didn't work.

Recent ruby versions are supporting __dir__, as far as I know.

@flyweights
Copy link

I'd like to know, too. Thank you

@noniq
Copy link
Member

noniq commented Apr 28, 2019

This command script (written in Ruby) tries to load the current Rails app, so that it can read the #columns_hash data for the selected model. However, because the command also uses TextMate’s own Ruby API, it needs to run using Ruby 1.8 (this API is not yet fully compatible with Ruby 2).

Rails has dropped support for Ruby 1.8 in version 4.0, so this command will fail when run for a Rails app using Rails 4 or newer.

Ideally, this command should be rewritten in a way that does not require loading the Rails app inside the command script. I suppose the commands for accessing and parsing the model’s column data could be executed by shelling out to bin/rails runner "…" instead. This would have the benefit of automatically using the correct Ruby version and respecting all kinds of customizations (preloaders like spring, configuration settings from env vars, …).

Would you like to create a pull request?

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

No branches or pull requests

3 participants