Category Archives: Ruby on Rails

I was reading a book Pro Spring, which covers DI (Dependency Injection) and MVC on Java. I had the same feeling with peterkrantz, yes, too much configuration works. Rails is way better than that. How can Spring.net succeed?

Then I started looking for asp.net MVC framework, somebody is talking about MonoRail, others prefer Promesh.net, and castle… Finally, I realized that MonoRail is a part of castle open source project. In fact, I needed to install Castle Project assemblies to start playing with MonoRail.

After 2 hours lab, I was so pleased by its similarity to Ruby On Rails. Hope one day MS will adopt it as its official MVC framework to asp.net.

I had some compiling error/warning in my VS2005. “XML document cannot contain multiple root level elements.” in most of my vm(view) files, “Invalid token ‘Text’ at root level of document. ” for “#if($Flash.error)” statement. The web app runs OK with those errors. Later I removed those vm files and re-created one by one by selecting file type as ‘plain text’ instead of ‘HTML’, suddenly, all the errors went away.

When following Cory Foy’s tutorial, I found some updates.

  1. There is no Ruby.zip in either fitnesse or rubyforge. After install the gem from rubyforge, (gem install and rake) I didn’t see FitServer.rb appear in ruby\bin folder. (probably he was in Linux) Later, I figured out this ruby.zip is not needed any more.
  2. As README in RubyFIT gem said, the configure of command pattern should look like this:

!define COMMAND_PATTERN {/path/to/ruby/ruby -I %p -I /path/to/RubyFIT/lib
/path/to/RubyFIT/bin/FitServer.rb}

Of course, if ruby is in path, the first ‘/path/to/ruby’ is not necessary.

Everything else works OK, and I didn’t see that ugly error when I first run. Without “!path C:\tmp\ruby”, my test page just kept as clean as an empty one. Such a good improvement made me confused at first, not use to no-error test yet.

1. rails hello
2. cd hello
3. ruby script\generate controller hello
4. Create a file called index.rhtml in app/views/hello, containing “Hello world”.
5. ruby script\server
6. Navigate to http://localhost:3000/hello in your browser and be greeted with your friendly application: “Hello world”