I am using Ruby on Rails 3.2.2 and I would like to check if a Integer is greater than 0 and, more in general, if a Integer is greater than another Integer.
There is some Ruby or Ruby on Rails method to make that “easily” / “efficiently”?
Note: I would like to use / state that method in my view files and I think, if that method do not “exist”, it could be better to state a “dedicated” method in my model or controller file and use that method in my views.
As shown here:
You can use standard Ruby within your views between
<%and%>. And yes, you could implement a helper do to the check and use that helper method in your view.