Coucher - Super simple RESTful HTTP service with Rack and CouchFoo
I was learning CouchDB with CouchFoo yesterday. IMHO they are sweet combination and I’m really exited to see how they will mature.
My real task at the moment was, however, to develop a RESTful HTTP service using Rails and as simply as possible. I had some success with Inherited Resources plugin and plain ActiveRecord. I then realized that perhaps having Rails is “too much” for my little service having only a simple XML interface and no HTML based UI or need for session handling. I digged into basics of Rack and suddenly had a great idea. I would only need a Rack aware server, CouchFoo and some Ruby code to implement my RESTful service.
I named it Coucher and here’s the code:
Smileys with Ruby
I needed a simple, preferably accessible, way to add smilies support to one of my projects.

The first challenge was to find nice looking, but free to use, smilies. It was more difficult than you might think, because all the quality smilies I found did not accept commercial usage. Therefore, I ended up creating set of my own 
My original idea was to use a little helper that would markup a given text with smilies a bit. For instance:
This is funny :) This is hilarious :D
The markup'ed version would be:
This is funny <span class="smiley smile">:)</span>
This is hilarious <span class="smiley grin">:D</span>
Then, using one of those CSS image replacement techniques, I would display a graphical smiley and hide the text version.
The first problem I encountered was those techniques seem to work only on block level DOM elements. Smileys, however, should be part of the normal text flow. Another problem was that I could not make the text inside span dissappear and at the same time display a smiley graphics as background. Therefore, I needed another span. I also had to add some content inside the outer span so that Firefox would render it nicely and Internet Explorer would display it at all.
This is funny <span class="smiley smile"><span class="smiley-as-text">:)</span> </span>
This is hilarious <span class="smiley grin"><span class="smiley-as-text">:D</span> </span>
The CSS required to render the smileys:
.smiley {
background-repeat:no-repeat;
padding-left: 16px; /* The width of the image */
}
.smiley.smile {
background-image:url(/images/smileys/smile_16.png);
}
.smiley.grin {
background-image:url(/images/smileys/grin_16.png);
}
.smiley .smiley-as-text {
position: fixed;
top: -500px;
}
Why did not I just hide the smiley-as-text span? The answer: some screen readers would skip the smiley. To be honest, I don't know how screen readers handle smileys, but by not hiding the span, smilies will at least be read.
Here's the Ruby code I would use in one of my Rails helpers.
SMILEYS = {
':)' => 'smile',
':-)' => 'smile',
'=]' => 'smile',
'=)' => 'smile',
';)' => 'wink',
';]' => 'wink',
';-)' => 'wink'
} # and the rest of the smilies...
def smiley(text)
SMILEYS.each do |smiley, smiley_class|
text.gsub!(smiley, "<span class='smiley #{smiley_class}'><span class='smiley-as-text'>#{smiley}</span> </span>")
end
return text
end
What if I have varying font sizes and we want to use smilies that scales with the text size. Well, my solution is to create smileys for the each font size. E.g. wink_16.png would work well with 16px fonts. We do not need not to touch the Ruby helper at all. Instead, we handle smiley sizes using CSS and simply wrap the the text with a new class, for instance <div class='big-text'>This blog entry is about to end :(</div>.
.big-text {
font-size: 24px;
}
.big-text .smiley {
padding-left: 24px;
}
.big-text .smiley.sad {
background-image:url(/images/smileys/sad_24.png);
}
Browser testing with virtual machines

This is the promised follow-up to my previous blog post. So, how I do the browser testing myself using OSX and VMware Fusion. In short, the process is:
- Install a clean Windows XP
- Configure "minimal settings" to the virtual machine
- Copy three new virtual machines titled:
- Legacy Browsers
- Modern Browsers
- Future Browsers
- Install multiple browsers to each of these new virtual machines
- Clean up the OS, browser caches etc.
- Take a virtual machine snapshot (to return to a clean state anytime)
- Install Linux using the same procedure
Install Windows XP and configure virtual machine

Some hints:
- If you don't need USB, disable it (you will not get annoying Windows notifications whenever you connect your devices)
- You might want to enable printers, if you need to test the printing of your site
- You probably don't need much disk space (VMware Fusion is smart and actually spends the used amount of disk space!)
Copy virtual machines for browsers
With Fusion, you simply copy the existing virtual machine file and open it. You should cope with two or three virtual Windows instances. You do not want to create a new VM for every browser, because you will run out of disc space and CPU resources trying to run them parallel. Here's my set up:
- "Legacy Browsers"
- Internet Explorer 6
- Firefox 2
- Opera 8.5
- Java 1.4 (consider an older version!)
- Flash 8
- ClearType fonts disabled (as global Windows setting)
- "Modern Browsers"
- Internet Explorer 7
- Firefox 3
- Opera 9
- Chrome
- Java 6
- Flash 9
- ClearType enabled
- "Future Browsers"
- Internet Explorer 8
- Firefox 3.1
- Opera 9.6
- Java 7
- Flash 10
Where's Safari? Well, I don't need a virtual machine for Safari as I can use well working "standalone" version on my OSX (actually, Opera can be tested on OSX similarly). See details at my ultimate guide to browser testing article. You will also find download links to the software listed.
Clean up and take a snapshot
VMware Fusion (as well as many other VM solutions) support snapshots. Whatever I do within my testing sessions, I can easily return to a clean starting point. Before taking the snapshot, I...
- clean up browser caches
- tidy up desktop and Start-menu
Finalizing touches
If your browser testing is in active phase, you might want easier access to the browsers. With Fusion you can use a "coherence" mode so that the windows of Windows look just like any other app running on your mac. I even created a dedicated dock for my browsers and I can easily switch using Dock Spaces.

An ultimate guide to browser testing
So you created the coolest site on planet, and want to make sure it works on all web browsers and every configuration possible. Just download all the released versions of all the web browsers you know, spend some time installing and begin testing…
But hey, do I really need to install all those browsers/versions? And test with JavaScript on/off? Flash? Screen sizes? Well, if you absolutely want to make sure your site works in every possible browser configuration on planet, the answer is unfortunate yes. But if you are smart, you do a little research, create an appropriate browser testing setup, test your site and expect it to work 99.9% times.
Ingredients
The ingredients for the successful browser testing are:
- knowledge of layout engines and browsers
- official and unofficial browser packages
- de-facto rendering add-ons
- useful browser plug-ins
- web-based testing tools
- multiple operating systems
- a virtual machine player
Let’s have a look on each ingredient in detail.
Layout engines and browsers
Under the hoods of every browser is a layout engine that does the hard work of rendering your HTML/CSS/JavaScript into something visual. There are many more browsers than engines, and from the testing point of view, you should make sure all the major engines are covered in your tests.
Each engine has a long history and comes with number of versions. Is there any recommendations about what engines and versions I should pick for my testing setup? One of the most referenced one is Yahoo’s Graded Browser Support. Unfortunately, it does not say a word about layout engines, but you can easily catch up by checking out the List of layout engines. The point is; knowing browser engines give you confidence that if you test something with browser X, it will very likely work well in browser Y. In other words, there might be little reasons to test a site with both browsers X and Y, if they use the same layout engine.
You should also follow the browser statistics of your own site. Use a log analyzer such as AWStats or statistics collector such as Google Analytics. Needing someone else’s word on it, Browser Version Market Share or W3School’s Browser Statistics are good sources to refer.
If all this sounds too complex to dig into, here’s some details of the most popular engines and browser recommendations.
Trident
Internet Explorer uses a proprietary (Trident) engine. There are currently three major versions of IE on the market – all using heavily rewritten layout engine. Unfortunately IE versions tend to stay on the market for quite long time. My recommendation is to test carefully with IE 7 and keep IE 6 on your list – especially if you are providing a consumer service. As IE 8 hits the official release, be prepared to add it to your testing setup.
Gecko
Gecko is popular engine among open source web browsers, and used in Firefox. Firefox users tend to upgrade their browsers much quicker that Internet Explorer users. You probably play quite safe by testing with the latest major version number, and one generation backwards. Currently it means Firefox 3.1 and Firefox 2.0. Firefox is popular in all operating systems. Therefore, it is great for testing how differently Windows, OSX and Linux versions render your site.
WebKit
Safari is the most well known web browser using WebKit engine. WebKit is also becoming very popular among open source browser projects. The engine is surely popular enough to include in your testing setup, but testing with the latest version of Safari or Google Chrome is probably enough. iPhone, Nokia smartphones and many other handhelds use WebKit engine as well. If you definitely need to make sure your site renders perfectly on a device, you should test the site with a real thing or a device simulator.
Presto
Opera browser uses an engine called Presto, and the engine is used by some niche devices as well. I recommended doing occasional testing with the latest Opera version. Presto engine is very accurate and standard respecting. Therefore, do I dare to say, your site is likely to work well on Presto, if it works well on a Gecko or WebKit based browser.
Other engines
I also recommend occasional testing using one of the text-based browsers such as ELinks. It is an easy (but incomplete) accessibility simulator and reveals the missing HTML semantics.
Browser packages
Installing multiple browser brands into your OS isn’t usually a big hazzle. Perhaps you will witness a tiny non-bloody fight whether Firefox, Opera or Safari shall be the default browser in your system. On the other hand, running multiple versions of a single brand of browser is often tricky, sometimes terribly hard. It’s not too hard to guess that Internet Explorer is the enemy of web developer in this territory too, but other browsers, such as Firefox and Safari, aren’t really your friends either. But hey, let’s stop mocking and get the job done.
Internet Explorer
Internet Explorer is tightly tied to the Windows operating system. Don’t expect to install any version of IE without updating some “system DLLs” and a reboot. Therefore, running multiple versions of Internet Explorer is very hard. Even worse, you cannot officially test drive the forthcoming IE 8 without removing IE 7. The official Microsoft solution is to use special virtual machine images. The problem with these images is they are only provided in Virtual PC format, they expire within couple of months and they are sometimes buggy (the virtual machines, not the browsers). If this is your way to go, there are instructions on how to convert images to other virtualization formats.
Somewhat more convenient solution is to use unofficial “standalone” IE 7 and Multiple IE packages. Don’t expect these to work perfectly. They might e.g. have broken bookmarking or occasional crashing, but rendering engines should be accurate. An interesting alternative is the IETester in which you can test multiple IE versions at the same time on shared screen.
Microsoft offers the “normal” versions of Internet Explorer 6, Internet Explorer 7 and Internet Explorer 8 on their website. Older versions are found at Old App’s Internet Explorer archive.
Firefox
Installing multiple Firefoxes is not hard, but it is a bit cumbersome to keep those instances not messing up each other. There are many guides how to manage it. Mac users might be happier using MultiFirefox doing all the dirty work for you.
The official Firefox site provides downloads to the latest Firefox 3.0 version and officially supported Firefox 2.0. The “next generation” Firefox is always developed under a codename and 3.1 is called “Shiretoko”. The latest build should be found somewhere in Firefox Releases archive. Older versions are found at Old App’s Internet Explorer archive. The Mac archive misses quite many versions.
Safari
Forthcoming version of Safari (4.0) can be installed without conflicts side-by-side with the existing Safari browser via WebKit nightly builds. Unfortunately, this is not so easy with the older Safari releases. Multi-Safari is to rescue (Mac users) providing well working standalone versions of Safari.
Official releases on Apple’s site are Safari 3.1 and Safari 2.0, and the older versions are found at Old App’s Internet Safari archive.
Opera
It seems Opera has least problems running multiple versions side-by-side. I have had no problems installing any version of Opera and running them simultaneously on my Mac. Opera provides comprehensive collection of browser versions at Opera archive.
Mobile browsers
Despite most mobile browsers use the same engine than Safari does, the screen size limitations and smart zooming/scaling features almost enforce proper testing with a real device. If you don’t have one or testing is difficult due networking problems, you will manage with the device simulators.
iPhone simulator (on Mac) is bundled with iPhone SDK. Remember that you don’t need the install the full development kit. Just locate the simulator image, and install from there. A decent Nokia phone simulator (for Windows) can be found inside S60 SDK. Again, don’t install it all – just select the simulator from the installation options.
Text based browsers
There are a number of text based browsers out there and you’ll find good hints and links to actual browsers at Site Testing with Text Based Browsers.
De-facto rendering add-ons
Not everything you see on a web page is always rendered by the browser’s engine.
Flash
According to Adobe’s Flash penetration statistics, you could say almost all browsers now have a Flash player installed. On the other hand, most mobile devices do not play Flash at all. All the Windows versions of Flash player can be downloaded at Adobe’s Archived Flash Players.
Java
I could not find good penetration statistics for Java in browsers, but Java vs. Flash gives you a clear impression that Java is much less popular. But if your site has Java applets, you could test it with different Java versions. Sun provides comprehensive Java archive for all the versions ever released.
Browser plug-ins
There are tons of helpful plugins for Firefox and certainly good ones for other major browsers as well. From the testing point of view, let’s have a quick look on two essential plug-ins.
NoScript
NoScript is a popular Firefox plugin for blocking JavaScript, Java and/or Flash. You might not want to use it in your daily web browsing (or you do), but it certainly is an excellent tool for testing how your site behaves when users cannot view all your content. For instance, according to W3School’s Browser Statistics, in January 2008 JavaScript was not enabled for 5% of the web surfers.
Web Developer
If you are a developer, you are likely to use excellent Web Developer toolbar for Firefox. It is also great for testing your site e.g. without stylesheets or cookies, and testing the various screen sizes. Example resources of screen size stats are Market Share’s Screen Resolution and W3School’s Browser Display Statistics.
Web-based testing tools
No surprise, you can find interesting web browser testing tools in the web.
Browsershots
Browsershots is a wonderful tool to test rendering of your (public) site with a number of browsers in different operating systems. If you are in a hurry, you can pay for priority rendering.
BrowserCam
An advanced web-based tool for browser testing is BrowserCam. In addition to browser screenshots, with a paid plan you can get shots from mobile devices or have remote access to real browsers. I did not test this in practice, but it sounds very cool, if remoting works fast enough over the network.
Operating systems
Some popular browsers can be installed to multiple operating systems. For instance, Firefox is available to almost any platform. The rendering results, however, are never pixel-to-pixel same. The colors can look surprisingly different and text may have totally different typefaces. Even the operating system settings influence on the rendering results. For instance, some Windows fonts look really ugly without ClearType turned on.
An obvious solution for cross-platform testing is to have multiple testing computers or a single multi-booting computer with multiple operating systems installed. Using a virtual machine, however, might be far better solution.
Virtual machine players
With a virtual machine player you can e.g. run Windows while using Mac OSX. The major benefit of having a virtual machine instead of running a “real one” is that you can create multiple setups of a single OS. For instance, you could have one setup for running IE 6 and another for IE 7. Even greater, some players support “snapshots” providing an easy way to reset your system to a clean state, if you messed up something. In addition, testing becomes more streamlined when you use a virtual machine, if the option is to reboot your computer between the testing cycles.
These are the most well known virtual machine players:
- Virtual Box – A free VM player working in almost any OS
- Virtual PC – Microsoft’s free VM player for Windows
- VMware player – A very popular and free VM player for Linux and Windows
- VMware Fusion – A commercial VM player for Mac OSX
- Parallels Desktop – An alternative commercial VM player for OSX
An alternative VM technology for running Windows apps is Wine. With some work (and good luck) you may get a Windows app running “natively” in your Linux or OSX. There are instructions on running Internet Explorer on Wine and some helper scripts such as IEs 4 Linux.
Browser testing setups
So, how should I test my site? Well, it depends :-) If your needs are “light”, I would suggest a light solution. You could, for instance, simply use Windows with those unofficial “standalone” browser packages, and use a web-based service for checking the rendering under other operating systems. If you are building the next Facebook, I would certainly install a good virtual machine solution for each developer and a testing center with multiple PCs to the test-only guys.
My solution is somewhat “semi-hardcore” and requires quite a lot of preliminary work. Once you get it running, however, it is quite a pleasure to use. It consists of a VM player supporting snapshots. I have three Windows images titled “Legacy Browsers”, “Modern Browsers” and “Future Browsers”. Each image contains the most popular browser of each layout engine, but there are only one version of each browser brand. I also use older Flash and Java versions in the Legacy Browsers image, and beta versions in Future Browsers. WebKit testing I like to do with unofficial standalone Safari packages and I use multiple Firefox profiles for “feature X ON/OFF” testing.
I will post a follow-up about the details of my setup within my next post. In a meanwhile, happy testing!
RailsConfEurope 2008
Sitting back in the balcony of my Hotel Room and enjoying a bottle of Berliner Kindl. While I'm still here, and everything is still fresh in my memory, why not writing a report about the conference.
I have an advantage over many other participant by being relatively new to Rails and attending RailsConf for the first time. Therefore, I had "pair of fresh eyes" and I could get at least something out of every presentation I saw.
David's keynote about "legacy software" was not one of the most enthusiastic ones, but it indeed was inspiring and gave me good reasons to be even more proud about the legacy code I've written during the years. Jeremy Kemper's keynote about performance was a very good overview about "real performance" end-users experience when using web services. It also promised a slightly better performance in Rails 2.2 and some performance tools to play with.
Tutorials on Tuesday felt a little too much too long presentations. I would have hoped more hands-on exercises with more intimate feeling and personal assistance. Perhaps the organizers should limit the number of seats next time. The session about "resourceful plugins" was actually a tutorial about how to write good plugins. I've never written a plugin, so it was helpful for me. The afternoon session about deploying and monitoring Rails apps had more hands-on work, but network problems impaired the exercise a bit. The presentation itself was very clear, but could have gone more to the details (time should not have been a limiting factor here).
The two jQuery related presentations on Tuesday morning were interesting, but the one about unobtrusive scripting was definitely more helpful. Intellectual scalability introduced a very interesting solution to write complex write applications. The "JavaScript requirement", however, was something I could not buy in my personal projects. The ResourcefulViews plugin introduced in Restful everything seemed very useful. I have always problems to remember how Rails links and forms are generated, but this baby could be the cure. Hopefully something like this will end up to the Rails core one day. A talk about Security on Rails was very clear and well presented, but perhaps the content was a little too basic for RailsConf.
My Thursday morning started with Design on Rails for usability. IMHO it wasn't about too much about Rails nor usability, but nevertheless it made some very good points about creative design process. Starling+Workling presentation was one of the more entertaining ones. Internationalization is officially coming to Rails, and that's good news! From Rails security to application security introduced a very promising plugin called declaritive_authorization (not available yet?). I think the audience did not fully get the (splendid) message, because the presentation was perhaps a bit too academic. I would have wished How not to build a service was a bit more "juicy" one. One of the personally most useful presentations was Future is video. It was also very well structured and presented - a very nice finale to the conference.
The best thing about the Wednesday/Thursday presentations was that they were quite short. You should easily be able to concentrate the 40 given minutes, and on the other hand, it clearly made the authors think beforehand what to say, and how to organize the presentation. If I've got something to complain about, some presentation titles were somewhat misleading. The presentation description should also contain a word or two about "skill level" required.
I was a bit afraid the conference would have a little too fanatic "Rails is fucking awesome" atmosphere, but it turned out to be quite relaxed and down-to-earth, instead. My humble hint to the organizers is that try to keep RailsConf "advanced" (more advanced) and perhaps start organizing "mainstream" Rails events locally in Spain, Finland, Netherlands etc. And Rails is slowly but surely becoming mainstream, don't you agree?!
Will I attend next year? Maybe. Overall, I'm happy that I did go the RailsConf Europe 2008, and I surely learned a lot. Many thanks to anyone involved!
Namespaced models in Rails
"Rails does not scale".
I now have some experience writing software with Rails. I do not believe well written Rails apps would have particular problems to scale up in terms of number of people using the app. Application size, however, seems to be somewhat difficult scale up with Rails. If your app is a bit more complex one, and require lot of model classes, you will likely have problems to keep your app well organized. You might e.g. have hundred classes or fixture files under one directory. You might also have problems with limited namespace and end up using long and ugly looking class names.
Ruby support namespaces and organizing apps using modules. Rails has an assorted support for namespaces. For instance, ActionPack supports namespaces well. On the model side the support has been somewhat vague, but it seems Rails 2.1 and especially the lates Edge Rails support namespaces in ActiveRecord quite well. I don't hear any praise about this great development in the Rails community, but for me, this is great news. Namespaces not only keep me organized and allow sensible class names, they naturally facilitate writing a better architecture and a bit more modular code. There are some workarounds there, but I really think true and complete support for namespaces would indeed be useful.
My personal project is still very much under development, and I use Rails generators lot. And I am using those namespaces in my models. Therefore I decided to tune Rails generators to support namespaces as well. Now I can:
script/generate scaffold Animal::Dog name:string gender:string
This will generate model, controller and views so that you can access them by:
http://localhost:3000/animal/dogs
It also generated working tests and a fixture file, all well orgnized under folders names "animal".
I also changed the naming convention of database names so that namespaced model will be prefixed using the module name (e.g. animal_dog).
I created a ticket to Rails Lighthouse including my patch. I think this is very cool (even hot) stuff, but not seeing too many comments yet. Do give it a try and let me know what you think.
Web graphics software for a guy like me
In my current project, one of my aspirations is to use free or "cheap" software whenever possible. In the server side it is easy as Rails, Apache, Ubuntu etc. are open source and come with flexible no-charge licenses. For productive development you might have to buy some licenses, but usually don't need to spend much. For any serious developer, 50 euros or dollars should not be a problem for such a great product such as Textmate.
Exception to the rule is graphical design. There seems not to be decent, free or "cheap", solution for creating those mockups or giving tasty final per-pixel adjusted looks to your site. I know some people can cope with free solutions such as GIMP or you could create web graphics using Pixelmator, but when it comes to productivity, you really need helpers for grid layouts, tools for slicing and optimizing images for web. Icons and illustrations usually form up better with vector graphics and then you have even less choices.
De facto tools for web graphics come from Adobe family. Photoshop and Illustrator will certainly do the job, but they are pricy. If you are a web-UI developer and you spend most of the time with the products, any price tag should be fine. But if you are like me, no time nor capacity to become an ultimate UI designer, but still occasionally need to create decent looking graphics, you probably don't want to pay 2 000 euros for the software.
Fireworks is a little less known Adobe product, but some people argue it does everything you can with Photoshop and Illustrator. Not everything, but anything you need for web graphics. Adobe promotes Fireworks with the phrase "Rapidly prototype and design for the web", which gives an impression that you might need something like Photoshop for the "real thing". According to these blog posts, this is not the case, and I bought it. The price tag is not anything you could call cheap, but it certainly is affordable $300.
My first impressions of Fireworks are great. The insane part of the story is how Adobe rates the products in the two sides of Atlantic. Affordable $300 suddenly is €440 that is about 700 US dollars with today's exchange rate. People are naturally quite angry with Adobe, and some order Adobe products directly from USA. This is crazy, but Adobe is not likely to change the policy. And as long as we don't have those free or cheap alternatives, they probably don't have to.
ActiveRecord – first impressions
I finally had enough ideas, material and time to actually write some code to my project. So far I have mostly played with ActiveRecord, and what a wonderful experience it has been!
I liked:
- Declarative programming of relationships and validations
- The power of
has_many :through - Model inheritance "Rails way" aka single table inheritance or
:polymorphic => true
I particularly enjoyed playing with the model classes using Rails console seeing the "magic" (SQL) happening. Single table inheritance (STI) seemed a bit silly idea at first. In practice STI works extremely well, if your inherited models do not have additional attributes, but might e.g. have additional validation rules.
As always, not everything was just smooth as silk, and a few times ActiveRecord did not work the way I wanted.
I did not like:
- Model attributes are not visible in the Ruby code of model (I need to check out the schema.rb, migration files or database).
- If I define a database level constraint "no null", ActiveRecord will not validate the related attribute. Instead it will silently store an empty string.
These bugs I found:
- ActiveRecord does not support Ruby namespaces. For instance, STI will not use fully qualified class name in
typefield (e.g.Kennelinstead ofStakeholders::Kennel). :polymorphic => trueand STI together will use incorrectmodel_typefield (e.g. "abstact"Animalinstead of STI inheritedDog).
Despite a few tiny issues, ActiveRecord seems a great framework for persisting your models with a relational database.
Rails, Merb or Rails with custom components?
Not having written a single line of code to my project, I can still ponder with the technology, components and even framework to use. I really love Rails, but when I run into Merb, I was at least half sold. Now, I think, I have three choices to carry on with:
- Pick Rails and use the core components most of the time
- Choose Merb and use whatever components I like most
- Do the stuff with Rails, but use "better" alternative components often
The first option is probably the easiest for a beginner like me. There are many great books and tutorials that cover Rails, and they really focus on the default stuff Rails bundles.
Using Merb would probably give me some more freedom (and performance), but I would not get the same level of support as I would with Rails. Merb is probably "too young" framework for a newbie like me. If I chose Merb, I would definitely have a thorough look at DataMapper ORM. Compared with ActiveRecord, it feels more "right" model persistence solution (perhaps it is just my Java background), but not really having the experience, I won't say a word more.
While default components of Rails seem mostly great, I wouldn't say it always was love at first sight. I am very tempted to use alternative techniques such as Haml over Erb and jQuery over Prototype/Scriptaculous. It seems easy to switch a particular component, but I suspect it would come with a price of "how-to-figure-out-why-this-thing-does-not-longer-work-and-my-book-says-nothing".
I will most likely try to do it Rails Way. Don't think too much beforehand, and focus on writing the simplest possible code with whatever Rails have to offer for me. And of course, use the variety of Rails plugins available whenever I think I am reinventing the wheel. One day I will feel more like a real Rails developer packed with some real-life experience, and confidence for experimenting all the great stuff Ruby/Rails/Merb/whatever community have created.
Decent blogging platform?
Was not that hard? Writing the first post, I mean. Finding a blogging engine, however, suitable for my need was quite a task. I’m learning Rails, so I’d prefer a Rails option, of course. Other requirements were:
- easy to set-up
- easy to customize
- support for other languages (I have another blog in Finnish)
- simple (all I need is blog posting, simple formatting, commenting, RSS, tags and search)
The most active Rails blogging platform is Typo. Rails 2.0 compatible version 5.0 was just released. It “felt” mature and it would likely be end of my quest. Typo was straightforward to set up and it had an installer setting everything nicely up. Typo “had it all” and more, perhaps too much for me. Installing a new theme was a peace of cake. Sadly, non of the themes I tried worked. Actually, I could not switch back to fully working original theme. After poking around awhile, and could not get it working, I said ‘no no’ to Typo.
The next obvious option was Mephisto. Why obvious? Because most Rails gurus use it and the official Ruby on Rails weblog runs on it. I, however, was a bit suspicious — the latest release was year and half old, and the official blog seemed pretty much dead (the fourth article in the blog asked Is Mephisto Dead?). Well, I learnt that Mephisto is dead from the average blogger point of view.
To-be-come-one-another-guru-Rails-consultant I was not afraid to give Mephisto a fair chance. Grabbing the latest version 0.7.3 and running it with my Rails installation 1.2.X did not work. I couldn’t get the database structure created by typing rake db:bootstrap. After a short and painful battle I gave up and checked out the latest Mephisto version from the version control. No luck in getting it working, despite the fact that I had a brand new Rails 2.0.2 installed. After heavy googling I found out I also need to have correct versions of gem (1.0.1 works) and rake (0.8.1 works) installed. I finally got Mephisto that did not give annoying error messages when I tried to run something as simple as rake db:bootstrap. Now error messages were now absent, but still no hope for a working database. I investigated the situation further and found out that schema.rb was pretty much empty.
Needless to say I was frustrated and had no choice but continue my quest. The next candidate SimpleLog had the simplicity I appreciate. It was not hard to setup. I couldn’t, however, get it as shiny as the screenshots from the author’s site were. Actually, there were no graphics or stylesheets anywhere in my new blog. It probably was something simple to fix, but after a short investigation I did not find out what. Sorry Garrett, I ditched your little blogging software, but I still subscribe to your excellent (and funny) podcasts.
The next candidate I found is a true gem. Radiant CMS is something I will probably use in the future. Perhaps in the very near future as we are renewing the website of my “other work” at Futurice. I did not install Radiant, but spent some time investigating it. Radiant was like breathing fresh air after dirtying my hands with Plone. Now, I’m not saying Plone is not a fine CMS platform, but the simplicity of Radiant CMS won at least a small piece of my heart. Too bad, Radiant is not good enough as a blogging platform, even though it could be used for blogging (and some do). According to this presentation the next Radiant version 0.7 could be something for bloggers, but I would not buy these promises just yet.
I was fed enough to forget the “Rails requirement” and ready to try out something totally different. Something mature, I mean. PHP blogging options are many and one of the best known is Wordpress. I already had an Apache with PHP running, so installing (production ready) blog was simple. IMHO, so simple that Ruby/Rails should learn something about it. To install a new theme worked like a charm. So far, no complaints. Then I needed to customize it for my Finnish blog. It seemed I had two options: to install a Finnish version of Wordpress (which was two decades old) or to customize a theme of my choice. I picked the latter option only to find out how bloated the theme was and how horrible the customization felt with PHP. I started to feel sick, and went back to drawing board.
Actually, I went to watch a great movie and had a good night´s sleep. In the morning I felt strong and told myself to make the blog running within next two hours. I was smart enough to copy the schema.rb from Mephisto 0.7.3 installation, run rake db:bootstrap and rake db:migrate and got it running. I also found excellent Skittish theme, which was very easy to customize (even the Finnish version). The only problem left was I had no comments. I found out that you need to launch Mephisto in production mode (e.g. script/server -e production) to get commenting enabled. As a side-note, Mephisto truly needs a more active community around to survive. Now, however, it “works for me” and seem to work very well.
One option would have been “write-it-yourself” approach. There are many tutorials written such as Creating a blog in Ruby on Rails in more than 15 minutes. I considered this option, but decided I want to learn Rails with the actual project I will start doing. It will be much longer quest than launching this blog ever was.

