Tuesday, May 13, 2008

Dreamhost added ability to host Rails app using Passenger

I just saw this, Introducing Passenger for Ruby on Rails, on Dreamhost Blog. This should make deploying Rails applications on Dreamhost really simple now.

Passenger is mod_rails for Apache, as stated on their website. Maybe now is the time for me to give Dreamhost a try. I was thinking of installing Passenger on a VPS I use for testing purpose.

Wednesday, April 02, 2008

Rails is moving over to Github

It looks like keeping up with edge Rails for Windows' users will get harder in the very near future. Here is the post announcing the move from using SVN to Git. I look into using Git on Windows before but it doesn't work well on Windows. It works if you run it on top of cygwin. Otherwise, it is a no go for now.

Wednesday, March 26, 2008

Developing Ruby on Windows Platform

There is an interesting discussion over at Ruby Inside regarding "Is Windows a First Class Platform for Ruby"? I think there are two parts to this question.

Windows is definitely viable as a development platform using Ruby. I build and deployed a Rails website using Windows as the development platform. I had a few problems which I was able to overcome by googling around for a patch or two. No show stopper for sure. All the gems I need were working fine on Windows. A big thanks to those maintainers that kept their gems multi-platforms.

Windows as a deployment platform. I think this is where I draw the line. I didn't even think for a second about deploying the site on Windows. It is definitely not an option at all. Although, I am looking forward to IronRuby and its support for Rails. I know one of their goal is to be able to run Rails. IIS 7 is looking quite nice.

Monday, February 04, 2008

form_remote_tag with ajax and none ajax action

Does anyone else having the same problem as I do when trying to set the url for AJAX and none AJAX actions for the form_remote_tag? I always seem to forget how to do this. It always take me a couple of tries to get this right. Anyway, I am putting the correct way to do this here so I come back later when I forget.

<% form_remote_tag :url => {:controller => '/posts', :action => 'view'},
:html => {:action => {:controller => '/posts', :action => 'view', :id => @id}} do %>
<%= submit_tag 'View' -%>
<% end %>

<form action="/posts/view/1" method="post"
onsubmit="new Ajax.Request('/posts/view/1',
{asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;">
<input type="submit" value="View" />

Wednesday, January 30, 2008

What happened to nbrubyide daily build?

What happened to daily build of nbrubyide? I have been checking the last few days and there is no new build. I am so used to getting my morning nbrubyide fix. This is not a complain. I am just wondering.

Here is where I go to download the latest build.

Thursday, January 17, 2008

Converts a comma separated string of numbers into an array of integers

This is all there is to convert a string of comma separated integers to an array of integers.

>> "1,24,53,6,23,6,5".split(",").collect{ |s| s.to_i }
=> [1, 24, 53, 6, 23, 6, 5]

This is why Ruby is so fun to use. Is there a shorter way to do this than what I have?

Tuesday, January 08, 2008

Expose Module methods as Instance and Class methods

Have you ever wondered how to include a Module and has its methods be available as instance methods and class methods? I certainly did and after doing a little research I figured out a way to do this in Ruby. For the experience Ruby programmers out there, this is probably very obvious but for those that haven't completely figured out Class object and instance of a class then this should help a little. Or totally confused you.

I don't know whether it is wise to do this but at least it is possible to do. Anyway, enough talking. Here is the code in all it (not so) glory.

module Methods
def self.included(base)
# add methods in ClassMethods into the meta class

def hi
# accessing the meta class to call the
# real method
class << self

def bye
class << self

module ClassMethods
def hi
puts "Hello"

def bye
puts "Good Bye"

class Greeting
include Methods

# Calling Instance methods here

# calling Class methods here