Rails 3,使异常链接可单击并在编辑器中打开(textmate)
我在远程开发服务器上运行了 Rails 3 安装。是否可以使异常行可单击并在本地机器上的文本编辑器(如 textmate)中打开?如果我不必手动打开 textmate、查找文件和行号,我会节省很多时间。
Arts#index 中的 NoMethodError
显示 /home/demo1/app/widgets/art_widgets/list/display.html.erb ,其中第 9 行提出:
最诚挚的问候。 阿斯比约恩·莫雷尔
I have a Rails 3 installation running on a remote development server. Is it possible to make the exception lines clickable and open in an editor like textmate on my local maschine? I would save a lot of time if I did not have to manually open textmate, find file and line number.
NoMethodError in Arts#index
Showing /home/demo1/app/widgets/art_widgets/list/display.html.erb where line #9 raised:
Best regards.
Asbjørn Morell
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
刚刚找到了一个很棒的插件,它正是可以做到这一点! rails-stacktrace-textmate-linker-greasemonkey-script
通过单击安装部分中的链接安装rails-stacktrace-textmate-linker:https://github.com/ryankshaw/rails-stacktrace-textmate-linker-greasemonkey-script 这将加载greasemonkey-script。
转到附加组件 ->用户脚本 ->右键单击 Rails Stacktrace Linker,然后单击编辑。
编辑第 37 行和第 49 行。您需要将路径添加到您的 Rails 应用程序。
... href='txmt://open?url=file:///Users/atmorell/Dropbox/MorellusWallace/", ...
在 Firefox 中重新加载您的应用程序,并享受在 Textmate 中打开的可点击堆栈跟踪:)
获胜!
Just found a great plugin that does exactly this! rails-stacktrace-textmate-linker-greasemonkey-script
Install greasemonkey from here: http://addons.mozilla.org/en-US/firefox/addon/748
Install rails-stacktrace-textmate-linker by clicking the link in the install section: https://github.com/ryankshaw/rails-stacktrace-textmate-linker-greasemonkey-script This will load the greasemonkey-script.
Go to Add-ons -> User Scripts -> Right click the Rails Stacktrace Linker and click edit.
Edit line 37 and 49. You will need to add the path to your rails Application.
... href='txmt://open?url=file:///Users/atmorell/Dropbox/MorellusWallace/", ...
Reload your application in firefox and enjoy nice clickable stacktrace that opens in textmate :)
WINNING!
不是以简单的方式。
您需要一个在后台运行的软件来解释异常页面以在其中添加链接,然后打开该软件、文件并查找指定的行。据我所知,没有第一方解决方案。
Not in a simple way.
You'd need a software running in the background that would interpret the exception page to put links in it, and then open the software, file and find the line specified. As far as I know, there's no first-party solution.
我还想要 Rails 错误页面中的 textmate link(txmt://) 。但到目前为止还没有成功。
rails-footnotes 具有类似的功能。它将 txmt 链接插入到每个页面。但不在错误页面中。
有人在轨-talk邮件列表问了同样的问题。并说merb有这个功能。
I also wanted textmate link(txmt://) in Rails Error Page. But until now no success.
rails-footnotes has similar feature. It insert txmt link to every page. But not in Error page.
someone on rails-talk mailing list asked same question. and said merb had that feature.
添加 Rails 脚注 gem 将为您在应用程序跟踪中提供可单击的文件引用。
https://github.com/josevalim/rails-footnotes
我发现这个 gem 减慢了我的开发环境稍微降低了它的主要功能,我只需要它纯粹用于可点击的文件引用。您可以通过在应用程序根目录的 .rails_footnotes 文件中添加以下行来完成此操作。
Adding the rails footnotes gem will give you clickable file references in your application trace.
https://github.com/josevalim/rails-footnotes
I found this gem slowed my dev environment down a little so disabled it's main functionality, I only needed it purely for the clickable file references. You can do this by adding the following line in the .rails_footnotes file in the root of your app.