Using sanitize within a Rails controller

后端 未结 3 1986
时光说笑
时光说笑 2020-12-25 12:49

I\'m trying to call sanitize within a controller. Here\'s what I tried:

class FooController < ApplicationController
  include ActionView::Hel         


        
3条回答
  •  暖寄归人
    2020-12-25 13:09

    you can use this ActionController::Base.helpers inside action method:

    class SiteController < ApplicationController
      def index
        render :text => ActionController::Base.helpers.sanitize('bold')
      end
    end
    

    Hope this helps

提交回复
热议问题