try to understand rails source code