Wednesday, October 19, 2005

My notes on using RadRails for Eclipse + Ruby on rails development

I have not seen (yet) very much online documentation for RadRails so it is worth noting a few things that I do:
  • Start by installing (as needed) Eclipse, RDT, and RadRails
  • Use RadRails to setup a new blank Ruby on rails project
  • In Eclipse, make sure that you switch to the "Rails perspective" (instead of the default "Java perspective")
  • Design the database schema for your application and be sure to follow the RoR table naming conventions (e.g., a table named "users" for an automatically generated model for class "User", table "doc_acls" for model "DocAcl", etc.)
  • Rails will want 3 databases with names ending in _development, _test, and _production). Create your development database with your application tables. Then, in Eclipse/RadRails, edit in the database information
  • Outside of Eclipse, generate models and scaffolds; for example: "ruby script/generate scaffold User Admin", "ruby script/generate model Group", "ruby script/generate model GroupAcl", etc.
  • Return to Eclipse/RadRails and do a "refresh" on your project so that Eclipse 'notices' all of the Ruby source files, .rhtml files, etc. that you just generated
  • RadRails has a view (lower right part of Eclipse window) with a 'Server" tab - use this to start and stop WEBrick for testing. Point a web browser at
  • Enjoy...
P.S. a reader (thanks Mel!) just sent me this link showing how to do RoR development on Eclipse - I especially like Brian Hogan's hint for editing rhtml files with syntax highlighting.
P.S.S. reader Murphee (thanks!) pointed out that you can use the New menu (in the Rails perspective)to create scaffoldsand models - no need to create these externally to Eclipse.

No comments: