Software:
News ToolsReg Shops |
Comments on ‘Ruby runs on Rails with NetBeans’Build a web application in minutesPublished Wednesday 13th February 2008 07:19 GMT
Great...By Robert Grant
Posted Wednesday 13th February 2008 09:33 GMT
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. BrokenBy The Other Steve
Posted Wednesday 13th February 2008 13:10 GMT
As since version 2.0, this doesn't work : class PostController < ApplicationController scaffold :link end 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. Broken...By Pan Pantziarka
Posted Wednesday 13th February 2008 15:10 GMT
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... Pan Rails 2 TutorialBy Huw Collingbourne
Posted Thursday 14th February 2008 09:23 GMT
For the benefit of anyone who's run up against barriers when using Rails 2, you might find my tutorial useful: http://www.sapphiresteel.com/How-To-Create-A-Blog-With-Rails-2 This assumes you are using Ruby In Steel but if you enter the scripts as shown you will also be able to use it with the traditional Ruby/Rails command prompts. It will at any rate get you over the Rails 2 scaffold script incompatibilities which have broken so many Rails 1 tutorials. best wishes Huw SapphireSteel Software Ruby and Rails In Visual Studio http://www.sapphiresteel.com The period for commenting on this story has finished |
|
||||
Top 20 stories • All The Week’s Headlines • Archive • Search