SV RoR March Meetup

The February meetup of the Silicon Valley Ruby on Rails (SV RoR) group had speakers present on their experience with bringing a Rails application from concept to production. For the March meetup, Brian Moore from feder8 presented on his experience with bringing his social site to production.

Since most Railers are adherents of the Don’t Repeat Yourself (DRY) principle, Brian discussed how he found it convenient to share methods amongst different helpers. Brian reminded the audience of the Ruby mixin capabilities and suggested that you mixin helpers via the Ruby include method. I have written a Ruby mixins tutorial which describes this in detail.

Brian also warned that Rails logs everything, this includes login names, passwords, email addresses, credit card numbers, and any other value submitted via a form. Fortunately you can tell Rails to filter out certain form elements from being logged. For example, in your ApplicationController (application.rb) you can add the following code if you want the value of any text field named ‘password’ to not be logged.

[source:ruby]
filter_parameter_logging :password
[/source]

Brian also advised not to expose your default database id in the application’s URLs. By default database ids are mostly sequential and therefore can be used by competitors to decipher how many users you have, how many users sign up per day, how much User Generator Content is submitted to the site on a daily basis. In general Brian suggested that it is a bad idea to leak ids in your URLs.

As a general rule of thumb, Brian recommended that a given page should never take longer than half a second to load and render. To achieve this half a second rendering you might have to do a substantial amount of caching. Also to try to achieve this half second rendering time, Brian recommends to never ever calculate a value twice. For example, if your site contains images and you concatenate the image filename with the server URL. This type of calculation can be done once and the resulting value can be stored in the database so as to achieve a better overall performance.

In the question and answer discussion, he was asked how long it took him to go from idea to something real. Brian said six weeks and added, “You guys all know that it is pretty easy to ship something barely functional in rails.”

Technorati Tags: , , , , , , , , ,