开发者

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
开发者_如何学C

end

How to use helper functions in Lib classes?


include CarHelper in your MyLibrary class should do the job .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜