Do use parentheses in Rails
August 23rd 2011In this article I will explain why you should ALWAYS use parentheses in method calls.
Assume you have the following code in your Rails views:
link_to 'Articles', articles_path
then you decide that you need to add I18n (internationalization) to your application and you replace all strings with
I18n.t 'ui.articles'
which gives you:
link_to I18n.t 'ui.articles', articles_path
See the problem? This line will not raise any exceptions. Just link to the wrong page. Very hard to catch unless you have proper tests set up.




