back to article Ruby runs on Rails with NetBeans

Having limped along in the wake of Eclipse, Sun Microsystems' NetBeans is getting its second wind. One thing that's helping is a fresh focus on scripting, particularly around Ruby on Rails. In this piece, I shall show how well Ruby on Rails has been integrated into NetBeans using the creation of a very simple application as an …


This topic is closed for new posts.
  1. Robert Grant


    I did a similar tutorial from the netbeans site; it now seems to be a much, much better editor. However, I'd like to see a slightly more advanced tutorial, as there are many, many ones about how to make something that's really simple but useless, and far fewer that actually take it to a useful level.

  2. The Other Steve


    As since version 2.0, this doesn't work :

    class PostController < ApplicationController

    scaffold :link


    Because there's no dynamic scaffolding in newer versions. So if you are using Ruby 2.0 or higher, all the tutorials you read will fail.

    When you run the generator, select 'scaffold' rather than model, and type your "Link url:string description:text" into the "Model Name" box. This will generate a controller for you called links_controller.rb (and lots of other files)

    Then Right click the project node again and click select Migrate Database > To Current Version. This will create the relevant database table and ruby scripts.

    Additionally, routes.rb is under Configuration, not Configuration/Environments as stated, and you don't need to edit it, the scaffold generator did that for you. The url is now ...localhost.../links, although you can always type "Post" in the scaffold generation to change this back.

    To add the tags field, right click the Database Migrations node, select Generate, then type "NewTagsField tags:string", OK, (this generates your 002_new_tags_field.rb) and then do the DB mIgrate thing again.

    At this point you must either add code, or just regenerate your scaffold using "Link url:string description:text tags:string".

    A quick tip for newcomers to the Netbeans IDE, get into the habit of running your project by right clicking the project node and selecting 'Run', because pressing the big green play button will not always run the current project. Netbeans has a few gotchas, but it's worth sticking with it. (Eclipse makes me want to set my own hair on fire.)

    I fell heavily into the trap of version differences when I started getting into rails (last week), and it's a shame to see El Reg propagating the misery. Next time, Pan, maybe you could make sure that your tutorial will work on the latest version of the software you're talking about, since this is likely to be the version that newcomers will have installed.

    In fairness though, 2.0 was only released in December, and the lack of backwards compatibility is catching a lot of people out.

  3. Pan Pantziarka


    The Other Steve -

    Unfortunately this is an area where things are changing pretty fast. The tutorial uses what's in the current pre-packaged releases of NetBeans 6.0 and the Ruby Pack - in other words this is still version 1.0.x of JRuby and 1.2.3 of RoR. As of now this is still the latest pre-packaged version of the software that comes with NetBeans.

    But point taken, in general we try and keep as up to date as possible given time constraints and deadlines...


  4. This post has been deleted by a moderator

This topic is closed for new posts.

Biting the hand that feeds IT © 1998–2019