Inline your helper_method declaration
Remember, def
is just a special function in ruby and as such it has a return value that is a symbol that is the name of the function being defined.
That allows us to do some cool (weird?) looking things with class methods that take a symbol that refers to a function, like the helper_method
call in a controller.
class DataController < BaseController
#actions and whatever
private
helper_method def format_that_data(data)
"#{data[0]} X #{data[1]}"
end
end
Tweet