问题
I'm working on a Ruby on Rails project and sometimes I need to run a script. Everyone else seems happy running their own server and scripts through the console. I on the other hand really want to write my code, press a button and have Aptana run my script. For one I hope this will enable breakpoints.
How do I make sure it knows the database classes, currently I get TableName unknown name error. "require 'table.rb'" gets me a cannot load file error. Tried adding the file path with / and \, omitting the file extension, using ' or "
What is the hotkey for running current file (whatever pressing the play button is)? Or how can this be configured?
When I ask Aptana to run a file, I want to automatically save it, how can this be configured?
Edit: I have found the hotkey for running current file is Ctrl + F11, not only is this an uncomfortable combination, it's already in use by Kubuntu and breaks things :( Also recently Aptana started asking what kind of application I want to run the code as: 1. Ruby Application (always choose this one) 2. Ruby Application (? again...) 3. Test::Unit Test
Clearly I need to change the hotkey hand have it choose Ruby Application at default.
回答1:
I don't think you have to change the default hot keys.
Answer to your Q1: You have to config your Aptana IDE to know your Rails project. please refer ror_master's link.
Answer to your Q2: alt + shift + x , then press 1 of the listed options ( t, x, etc)
Answer to your Q3: Your demand is not a good practice, I think. Make sure that you have to MANUALLY save all the files before you do any operations like running a unit test. Please make it as a habit.
Further more, it seems that you are using linux OS like ubuntu? If so, please forget Aptana or other IDEs, VIM + console will satisfy you, and by using these basic tools, you will be more clear of what you are running and the necessary environment knowledge of deploying & running Rails application.
I have 3.5 years of Eclipse and 1 year of Aptana experience, and yes, they are both great IDEs (almost the same), however, about 1 year ago I turn to VIM, which saved my life.
UPDATED: thanks for the so much bonus scores! Here are more tips for you:
whatever you are using ( Aptana, Eclipse, Netbeans, VIM) , do remember that the HOTKEY is important.
in Apatana/Eclipse, you should know these keys:
- quick open file: ctrl + shift + r
- quick open in recent file: ctrl + e
- method outline: ctrl + o
- switch : ctrl + F6 , ctrl + F7
- inspect a method from the statement where it was called: (move the cursor to it then press) F3, or press ctrl key then left click your mouse.
- in Apatana for Rails:
- ctrl + shift + c : quick jump to controller
- ctrl + shift + v : quick jump to view
- ctrl + shift + m : quick jump to model
VIM has a steep learning curve for us, in my experience, the first 2 weeks is the hardest time. Remember google is your best teacher. and here are the VIM plugins that I am using:
- autocomplpop
- fuzzy_file_finder
- greplace
- mru
- nerdcommenter
- project
- rails
this article is worth reading: Using VIM as a complete ruby on rails IDE
回答2:
To change hotkey:
- Go to
window
menu (Press alt key if it isn't there) - Select
preferences
- Select
General
tab - Under
General
selectkeys
- There you'll be able to change keys
回答3:
For configuration and debugging with rails
I will prefer this lnk How to debug ruby on rails in eclipse aptana plugin
There are many otgher helps also in the net
http://madcoderspeak.blogspot.com/2008/02/showmethemoney-15-aptana-radrails-hell.html
http://beans.seartipy.com/2008/09/03/setting-up-rails-development-environment-using-aptana-studio/
https://radrails.tenderapp.com/kb/developing-rails-projects-with-radrails/debugging
回答4:
Just edit the Run Configurator for Firefox, and in the Browser executable area copy the filepath of Chrome, and it runs fine.
来源:https://stackoverflow.com/questions/8787573/how-to-configure-aptana-for-instant-running-of-my-script