Custom Helper Functions in Lib Classes

In rails 3, can helper functions be used in library classes? For example, I have an assistant:

module CarHelper
  def total_price(cars)
    #Do something here
  end
end

In my lib / my_library.rb

class MyLibrary
 def myFunc
   # I would like to use helper function total_price(cars) here
 end

end

How to use helper functions in lib classes?

+3
source share
1 answer

incorporating CarHelper into your MyLibrary class should do the job.

0
source

Source: https://habr.com/ru/post/1795980/


All Articles