简体   繁体   中英

How to use ActionController::Base.helpers.strip_tags in custom class

Ruby newbie here.

I create a class called My_table (without extend anything). I want to use ActionController::Base.helpers.strip_tags(text).

I put the following on the top of my class, but that doesn't work.

require 'rubygems'
gem rails

Not tested but what about something like this:

require 'rubygems'
require 'action_controller'
puts ActionController::Base.helpers.strip_tags("<p>Testing</p>")

Obviously you need to have the rails gem installed first ( gem install rails from the command line) but there shouldn't be any reference to gem rails in your ruby script.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM