Tutorial :How do I run alternative Rails generators in NetBeans?


Does anybody know how I can run alternative Rails generators in Netbeans 6.7? I have installed nifty-scaffold and want to want to find how I can run the following command from the IDE:

script/generate nifty_scaffold etc ....  

I have installed the nifty-scaffold gem, but it does not appear in the drop-down list when I select 'Generate' for my project.

(I am running NetBeans on Windows)


It would be very easy to add new generator extensions in netbeans. Netbeans doesn't do it automatically, you need to do it manually. I am using NetBeans ver 6.8 and installed nifty generators successfully in netbeans by following procedure:

1. Download gems file of ryanb's nifty generator freely available.

2. install in netbeans from tools->rubygems-> install Local

3. go to the directory C:\Program Files\NetBeans 6.8\ruby2\jruby-1.4.0\lib\ruby\gems\1.8\gems\rails-2.3.5\lib\rails_generator\generators\components. It shows all the generators available in netbeans.

4. go to the directory C:\Program Files\NetBeans 6.8\ruby2\jruby-1.4.0\lib\ruby\gems\1.8\gems\nifty-generators-0.3.0\rails_generators. It shows the nifty generators which you have just now installed.

5. Copy all nifty generators to components directory shown in step 3.

6. right click on project and click generate and you will find the udpated list of all new generators

By Vikas Maan


I assume that when you say you installed the gem, you did so through the Generate...->Install Generators button?

However, it does seem to be a defect. I've tested it too on Windows & Netbeans 6.7 and reproduced your problem - Netbeans can't find the generators even though script/generate can. It's probably worth shooting an email off to the Ruby Netbeans mailing list and/or filing a bug here.


You can create a folder named "generators" in your "lib" folder and put any generator folders in it and it should be working.

Or put that "generators" folder in your "vendor" folder.


Link to nifty-generator GEM(version 0.3): http://rubyforge.org/frs/?group_id=6986

I wasn't able to install local gem from github, but above link works.

It works with Rails 2.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »