[Ruby] [Rails] Regarding the presence or absence of parentheses as an argument of the render method

less than 1 minute read

Do you put parentheses in the argument of #render method? Don’t you wear it?

In conclusion, both are OK. Parentheses can be omitted when calling a method in Ruby.

So there is no problem with either of the following two methods.




render "posts/new"
* However, when writing complicated code, it is better to put parentheses to make it easier to understand the position of the delimiter.