Archive for November, 2008
Wanna go for a stroll? It is getting winter again, at least in this part of the world so strolling outside might be a bit, err, cold. Instead I suggest you just walk some ruby objects this time instead?
Walking – in this context – means visiting an object and all connected subobjects, and visiting them [...]
Filed under: 1rad, ruby | 1 Comment
Tags: object walking, ruby
In functional tests a controller instance should not be reused: usually controller instances hold some state, that gets discarded in the normal Rails life cycle, and our tests must reflect that. Otherwise, tests can fail even if they shouldn’t, but even worse tests could succeed when they shouldn’t.
See this testcase:
require File.dirname(__FILE__) + ‘/../test_helper’
class DuuController [...]
Filed under: 1rad, Debugging Tools, ruby | 1 Comment
Tags: ruby, 1rad, rails, Testing, Functional Test
0×0a: Some optimization hacks…
We are working on a somewhat larger Rails application, and one of the actions renders a table with up to 9.000 table elements. Now, somewhere when rendering that table we use a line like
some_array.collect(&:some_method)
and this line gets called several thousand times. As you can imagine this turns out to be not super-fast. But to our [...]
Filed under: ruby | Leave a Comment
Tags: performance, rails, ruby
0×09: Atoms and their packages
Every now and then I come across someone that doesn’t really know about Ruby symbols. That comes as no surprise, because most programming languages don’t have something like that as a built-in type. And Rails’ HashWithIndifferentAccess (this is the class of the params hash that you deal with during actions) certainly doesn’t improve the situation: [...]
Filed under: 1rad | Leave a Comment
Tags: rails, ruby