alexpls/Rails-Latest-Migration

Error when trying to open latest migration

gs opened this issue · 2 comments

gs commented

Hi,

I've just tried your plugin on OSX, but when I run I got an error in console :

Traceback (most recent call last):
File "./sublime_plugin.py", line 362, in run_
File "./RailsLatestMigration.py", line 7, in run
File "./RailsLatestMigration.py", line 39, in parent_path
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.py", line 67, in join
elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Br,
Grzegorz

Hi gs,

Thanks for raising this issue, I can't manage to replicate it on my OS X machine running the same Python version as you.

Could you open up any file in a Rails app and type in view.file_name() into the console? Let me know what it outputs.

The only explanation I can think of at the moment is something weird going on with the filepath that Sublime Text 2 provides to the parent_path function.

Thanks again, Alex

I think I've found the issue. Were you running the Rails Latest Migration command on an unsaved file? This would produce the error that you have just described.

I will adjust the readme to better reflect that a Rails app file needs to be opened for the Latest Migration command to work, and I'll also add in some better error handling for cases like these.