advertisement

Print

Ruby on Rails Meets Eclipse
Pages: 1, 2, 3, 4, 5

Similarly, create configurations to create a Ruby model script, create a controller script, create a scaffolding, and run the rake command. To create a model script, specify ruby.exe in the Location field, specify ${project_loc} in the Working Directory field, and specify script/generate model {string_prompt: Model name} -f in the Arguments text area.



Create Model Configuration
Figure 5. Create model configuration

To create a controller script, create a configuration, "Create Controller." Specify ruby.exe in the Location field, ${project_loc} in the Working Directory field, and script/generate controller {string_prompt:Controller name} –f in the Arguments text area.

Create Controller Configuration
Figure 6. Create controller configuration

We also need to create a configuration, "Create Scaffold," for creating scaffolding classes. Specify ruby.exe in the Location field, ${project_loc} in the Working Directory field, and script/generate scaffold {string_prompt:Model name} {:string_prompt:Controller name} –f in Arguments.

Create Scaffold Configuration
Figure 7. Create scaffold configuration

We can now create an example Rails application, and a CRUD application to create a catalog entry, read a catalog entry, update a catalog entry, and delete a catalog entry. To create a Rails application, select the Ruby project "catalog" in the Ruby Resources view, and select Run>External Tools>Create Rails Application. A Rails application, catalog, gets created with the directory structure shown in Figure 8.

Rails Application Directory Structure
Figure 8. Rails application directory structure

In the next section, we'll create a MySQL database table using Rails migrations.

Pages: 1, 2, 3, 4, 5

Next Pagearrow