I’m trying to add this to my project:
class String
def escape_quotes
self.gsub(/["’]/) { |m| “\#{m}” }
end
end
I tried putting it in application_helper.rb, but it’s not getting found.
Where does it need to go?
Thanks,
Chris
I’m trying to add this to my project:
class String
def escape_quotes
self.gsub(/["’]/) { |m| “\#{m}” }
end
end
I tried putting it in application_helper.rb, but it’s not getting found.
Where does it need to go?
Thanks,
Chris
Hi –
On Sat, 25 Feb 2006, Chris S. wrote:
I’m trying to add this to my project:
class String
def escape_quotes
self.gsub(/["']/) { |m| “\#{m}” }
end
endI tried putting it in application_helper.rb, but it’s not getting found.
Where does it need to go?
Are you putting it inside the helper module, like this:
module MyHelper
class String
…
If so, you’re creating a new class called MyHelper::String. You need
either to put the String stuff outside of any other module or class,
or do:
class ::String
which means you want the top-level constant String.
David
–
David A. Black ([email protected])
Ruby Power and Light (http://www.rubypowerandlight.com)
“Ruby for Rails” chapters now available
from Manning Early Access Program! Ruby for Rails
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs