Ruby In Steel ArchivesBack to Ruby In Steel Archives
Ruby In Steel – Hints and Tips
If you have a problem or can’t figure out how to do something be sure to check the online documentation first, including this page.
Using The Rails Generate Dialogs
The Generate dialog lets you run Rails scripts without having to go into a command prompt to do it. Currently the available scripts are:
These are equivalent to running the following scripts at the command prompt:
ruby ./script/generate controller
ruby ./script/generate model
ruby ./script/generate scaffold
So, for example, if you want to run this script…
ruby ./script/generate controller Blog
…select the Controller option and enter Blog in the Value field.
To run this script…
ruby ./script/generate scaffold Post Blog
…select the Scaffold option and enter Post Blog in the Value field.
Rake has its own item on the Rails menu (it also has its own ‘leaf’ icon on the Rails toolbar). Clicking this is equivalent to running rake from the command prompt:
You just enter the command to rake in the Rake command field
Viewing Output of Rake or Scripts
The output from these commands is printed in the General page of the Visual Studio Output Window (if this is not visible, select the View menu then Output and make sure General is selected from the drop-down list). To try this out, click the Rake item on the Rails menu and, in the Rake command field enter:
This should display help on Rake in the General page of the Output window.
Open a Command Prompt
If the built-in dialogs don’t give you the features you need you can easily open a command prompt to run a script or load up a program in a selected directory. Just right-click a folder or a file in the Solution Explorer and select Command Prompt from the popup menu.