optimized rails snippets