Improving rails snippets