Menu

Articles about Rails

More than once writing view code for a Rails application ends up with a messy template file. The separation of structure and style doesn’t always work out as intended. Frameworks like Bootstrap force you to use nested structures and lots of class attributes. The view code ends up with a lot of duplication and is hard to read as a result. You’ll get away with that for a while, constantly fearing the next redesign…

Read more

Like any other build process, deploying Rails applications should be a quick and easy task. You should be able to deploy everything to your server with just one command. There are several tools available for this task. One of them is Capistrano, which is probably the oldest and by far the most popular deployment tool in the Rails community. Unfortunately the documentation is still not great and a lot of very handy features are unknown to many. Only digging through the API documentation and the source code reveals them.

Read more

When testing helper methods that use Rails’ output buffer (for example by calling concat) with RSpec, be sure to add this to your specs:

before (:each) do
  helper.output_buffer = ""
end

Took me a while to figure this one out. Apparently RSpec doesn’t initialize the output buffer and you end up with a NoMethodError on nil.

Read more

Yesterday I decided to give Phusion Passenger aka mod_rails a try and installed it. It was dead simple to set it up and to deploy rails applications with it. I’m now using it for several “small” applications, for which the whole overhead of setting up a cluster of mongrels and a proxy doesn’t seem to be adequate. I’ll give you a short summary on how to install mod_rails for apache2 on Debian Etch.

Read more