Class method vs constant in Ruby/Rails

前端 未结 4 806
野性不改
野性不改 2020-12-13 12:51

I was implementing a form that includes a hard-coded dropdown for a collection and I was wondering what would be the best solution, I know both ways exposed below work, stil

4条回答
  •  执念已碎
    2020-12-13 13:52

    The latter is better. If it were a method, a new array and new strings will be created every time it is called, which is a waste of resource.

提交回复
热议问题