0

I have created a local volt gem and I would like to write a simple api:

def add(a,b)
    a+b
end

But I don't know where to write this code and how to require it from the app. The only place where I have got it working is in controllers/main_controller.rb of the new created gem:

module DtPicker
    class MainController < Volt::ModelController
    end
    def self.add(a,b)
        a+b
    end
end

I think this is not the correct place but the lib folder. In this place I can't get it working. What am I doing wrong? Thanks.

1 Answers1

0

I have to:

require 'volt/dt_picker'

where I want to use DtPicker.add. The method is defined in the file lib/volt/dt_picker/dt_picker.rb:

module DtPicker
    def self.add(a,b)
        a+b
    end
end