I am trying to follow the short example in the following answer on using custom functions in rails:
http://stackoverflow.com/questions/2879679/where-to-put-code-snippets-in-rails
In math.rb in lib/math.rb
module Math
class << self
def cube_it(num)
num*3
end
end
end
In rails console I have tried
include Math
Math.cube_it(2)
But I get the error:
NoMethodError: undefined method 'cube_it' for Math:module