开发者

I have a ruby view that has this namespace: ActionView::Base.new but i want to add a new method to be available to this ActionView::Base class

I have a ruby view that has this namespac开发者_如何学Goe: ActionView::Base.new but i want to add a new method to be available to this ActionView::Base class.


in myapp/lib/action_view_monkey_patch.rb do:

ActionView::Base.class_eval do
  def method_name
    #do some stuff
  end
end
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜