search
top

How I use Netbeans 6 With Ruby on Rails

Netbeans 6.1 for Ruby on Rails is a great alternative to using textmate or vim for editing Ruby on Rails applications on a Mac. What I try to do is avoid using some of the features that Netbeans provides. Here are a list of the features that I have found to be useful in the Netbeans IDE and the things I still do in the bash terminal:

NetBeans

Command AutoCompletion

When you start typing a method name our attribute the auto completion will kick in and show you the possible commands.

Migrations

It makes it easier to do migrations so you don’t have to remember or type version numbers. All you have to do is right click the project and run a migrate.

Creating Files

Adding new files are easy in Netbeans you can copy and paste old files to create a new file or just right click and got to new file.

Navigation

The navigation menu in Netbeans allows you to easily find files in rails. The most useful shortcut that I have found is Control-Shift-O (Go To File) which uses auto complete to take you to the file you choose.

Database Connections

If you decide to use a database other than the default SqlLite, you would be better of creating a connection in Netbeans and managing it there. This way you can view your database structure and test SQL commands.

Bash Terminal

gem/plugin installs

Most of the tutorials for gems and plugins will be using commands for the command line so it’s just easier to install these this way instead of using the wizards that Netbeans provides.

Running Mongrel

It’s just easier to stop and start your Mongrel web server from the command line by running ruby script/server than trying to do it in netbeans.

Git

If you are using git for version control, you will be smarter to run your git commands from the command line instead.

Script/Console

If you are not familar with script/console it allows you to access your rails models and other stuff from the command line and run commands to test things out. For instance, if you have a Post model, you can run the Post.first command to see the first post in the model. Netbeans has a console also where you can run these commands so this one is up to you.

Solving GitHub Setup Permission Denied Error

When you follow the instructions on github to setup a repository you may receve the following error when you try to run git push orgin master.

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

This error means that you need to create a ssh-key. To generate a SSH key on a Mac just type:

ssh-keygen

After the file is created, run

cat ~/.ssh/id_rsa.pub

Copy the RSA token and go to github under account settings and add the key. You can give it any title.

Try to run git push orgin master and your git will work.

Connecting to a FTP server from a Mac

If you just want to connect to an FTP server via macĀ  and you don’t want a robust client, you can use the Finder.

Go to Finder >Go>Connect To Server… Next type this in the input box ftp://ftp.<yoursite>.com.

If your server requires authentication, you can pass in your password and username by typing the following:

ftp://<username>:<password>@ftp.<yoursite>.com.

This will allow you to access your files on a remote host or server.

top