Thursday, October 25, 2007

Running Multiple servers

Now this really isn't a hack for rails or a fix. Its a nice little thing built into rails that I just started using. Its running multiple rails programs on a localhost for testing.
Basically, the jist is you can run several RoR servers on the same computer as long as the ports are different.

To achieve this when you run a RoR server with the command :
ruby script/server
you can add a port option by adding -p and specifying the port number:
ruby script/server -p 3001

the default port is 3000, and you can't run multiple servers on a localhost without specifiying a port.

you can also use :Rserver -p 3001 if you are running it on Vim

Wednesday, October 24, 2007

Tackling VIM

Two posts ago I was talking about the RoR talk that Guy gave. Since then, I've learned how to use VIM. There is a bit of a learning curve but you'll see you'll start to work a lot faster about 2 days of continuous use (sleep is ok).

I've found T Pope's article to be very useful. Read that and all the links in the article and the preceding articles.

Stumbling into REST

I stumbled into REST accidentally about 1 month ago. Since then, I've learned to try (at least) to make the URLs more beautiful and this simplifying the sites that I create. Here are some resources I've found to be quite useful:

1) DHH's 2006 keynote
2) Episodes 35 and 67 of Railscasts

If anyone can add to this list, please drop a comment!

Thursday, October 11, 2007

PhRUG Ruby on Rails Talk

I went to a RoR talk last night in Ortigas. It was sponsored by Exist. The speaker was Guy Naor, the CTO of Morph Labs. Because he mentioned a bunch of stuff that I need to remember, here's a list of things people and I should do or at least look into if they are into Ruby on Rails:
  • Continuous Integration
  • Capistrano and SVN
  • The Ruby Way by Hal Fulton
  • Test Driven Development
  • Behaviour Driven Development
  • Vim & Rails
  • Know your regular expressions!
I've looked into these before but I didn't take that much importance to them. Now I know I should look into it some more!

Wednesday, October 3, 2007

You can't upload files via ajax alone!

Spent the morning figuring out something you can't do! I was trying to make an ajax file uploader but kept running into problems. I asked around #rubyonrails in freenode but got no answer so I did some searching... and found a thread of this person that tried to do the exact same thing.

Tuesday, October 2, 2007

helper: Toggler

I made a new helper to help out with toggling a div. To make sure the div is invisible upon load, make sure you add the style="display: none;" in the div.

To call the helper, use it like this:

<%= toggler("click me to open that div", "div-id") %>