Ruby Project or Ruby on Rails Project Node

See Also

The Projects window is the main entry point to your project sources. It shows a logical view of important project contents such as Source Files and Test Files (for Ruby Projects) or Controllers, Models, and Views (for Ruby on Rails projects). You can open the Projects window by choosing Window > Projects (Ctrl-1).

There are two types of Ruby projects that can be open in this window:

Ruby Project icon Ruby Projects. Projects without Rails support that have only Source Files and Test Files folders for the files. If you right-click the main project node for a Ruby project, you have a few Ruby project choices, such as New (add files), Generate RDoc, and Run Rake Task.
Ruby on Rails Projects. Projects with Rails support for models, views, controllers, and databases that you can test quickly from the IDE and run in the server configured with Rails. You can right-click the main project node and perform tasks like adding new files, generating models, views, and controllers, migrating databases, running Rake tasks, and so on.

The following list of tasks shows you some of the things you can do in this window with a Ruby or Ruby on Rails project node. For a complete list of tasks, see Working With NetBeans Ruby.

To perform this task... Follow these steps
Add files to your project
  1. In the Projects window, select the main project node and right-click it.
  2. Select New and choose the type of file you would like to add.
  3. In the New File wizard, specify the file name, location, and so on as needed, and then click Finish to create the file.
Edit files
  1. In the Projects window, select the node for your project and, if necessary, double-click it to open the node.
  2. Navigate to the file you want to edit and double-click it to open it in the editor.

For more information on the editor, see:

Generate a model, a controller, a migration, an integration test, and so on
  1. In the Projects window, select the main node for your Ruby on Rails project and right-click it.
  2. Select Generate to open the Rails Generator dialog box.
  3. Expand the Generate drop-down list and choose the item you would like to generate.

For examples of generating a model and a controller, see  

Migrate a database
  • To migrate a database for a Ruby on Rails project (for example, add tables that you have defined in a model), right-click the main project node in the Projects window and choose Migrate Database > To Current Version.
  • You can also revert the database to an earlier version by choosing one of the other To Version choices.
  • For an example, see  in the tutorial "Creating a Ruby Weblog in 10 Minutes".  
Run a Ruby or Rails application
  1. If your project is not the main one, right-click the project node and choose Set as Main Project.
  2. Click the Run Main Project Run Project button toolbar button or press F6 or choose Run > Run Main Project from the main menu.
    • You see a Ruby project's output in a window at the bottom of the IDE.
    • A Ruby on Rails project runs in the server configured with Rails and displays in your default browser.
      • To stop the server, click the X button Red X icon to the left of the server window at the bottom of the IDE.
Run a controller or view file
  • If you're in a controller or view file, press Shift-F6 to run the current file. Doing so starts the web server unless it's already running, then opens the browser on the URL corresponding to the current file.
Run tests on your project
  • For quick testing when editing a view or controller file, use Ctrl-F6, or Command-F6 on a Mac platform, to run the tests associated with the file.

    For full details on testing Ruby and Rails projects, see

Manage your Rails plugins
Run Rake tasks
  1. In the Projects window, select the name of your project and right-click it.
  2. Select Run Rake Task and choose the type of task you would like to run.
  3. Check the progress of the task in the Output window at the bottom of the IDE.
See Also
About Ruby Development in NetBeans

Legal Notices