User helper functions in Lib classes
In rails 3, is it possible to use helper functions in library classes? for example, I have helper:
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
开发者_如何学Cend
How to use helper functions in Lib classes?
include CarHelper in your MyLibrary class should do the job .
精彩评论