Questions tagged [html-safe]
75 questions
1
vote
2 answers
tiny mce display tags in rails 3
I am trying to store content of tinyMCE into "detail" coloumn.
Now when I display the content it displays wit all the
tags tags etc. This Is a security feature in rails3 . But I don't want the
tags to be displayed , I want it to be…

Gaurav Shah
- 5,223
- 7
- 43
- 71
1
vote
1 answer
html_safe doesn't work when I call truncate() method
I have a simple RSS feed for a website I'm trying to build. I want to do a read more link for posts and limit the output to 300 characters. My code looks like this:
<%= notice %>
What They're Saying About…

dmberko11
- 427
- 7
- 17
1
vote
1 answer
resolve XSS issue on ruby on rails
Example: If we store as a first name input, the value is getting accepted and stored.
When we display the data, an alert pops up. I understand that it's a Cross-Site Scripting (XSS). I have gone through…

Digvijay
- 7,836
- 3
- 32
- 53
1
vote
2 answers
how to show properly using Rspec the Double Quote Mark's " "
I'm using Rspec and the gem file_validators for testing and I need to put properly the output of the Quote Marks ("txt") like theses:
expect(page).to have_content expect(page).to have_content "You are not allowed to upload \"txt\" files, allowed…

rld
- 2,603
- 2
- 25
- 39
1
vote
1 answer
Undefined method html_safe for Nokogiri Html Document
I am trying to use .html_safe in the below description where I receive the error as Undefined method for Nokogiri HTML document.
blogs_controller.rb
@blog = Blog.find(19)
@description =…

useranon
- 29,318
- 31
- 98
- 146
1
vote
1 answer
Ruby on Rails form helpers are being escaped when they have errors
I am using Rails 2.3.9, and have installed the rails_xss plugin. I have made everything that needs to be html_safe, but have just noticed a problem when a form helper fails validation. When i enter an incorrect email address, and it fails…

dangerousdave
- 6,331
- 8
- 45
- 62
1
vote
3 answers
Unwanted characters - \r \n getting inserted into db - i need to remove them on my view page
I used html_safe, raw and also sanitize. But I still characters like \r \n — this is because i use "return/enter" key in Mac to go to next line when i enter data to my description field - which is textarea. Is there anyway to avoid these in my view…

Hayz
- 53
- 12
1
vote
1 answer
Rails 4 - Meta tags html safe
I am trying to figure out the best way to make my meta tags html safe. They are currently escaping out any html.
Here is my current setup.
in my application.html.erb:
and in my…

Kathan
- 1,428
- 2
- 15
- 31
1
vote
1 answer
Behaviour on html_safe? in Rails 3.2.1
I am trying to use the html_safe? method to check if a string/text which is retrieved from the DB contains any HTML. However, the html_safe? method is not returning the value I expected. Let's look at the following examples:
>> 'this is a…

Eric Pau
- 31
- 2
1
vote
1 answer
html_safe on whole html code block in rails
i can't seem to find a way to escape whole html block, if it is even possible.
Here is what i am trying to do:
%table
%tr
%th{rowspan: "2"}= t("public.home.graphic_title_payment").html_safe
%th.datefield{rowspan: "2"}=…

user2945241
- 360
- 5
- 19
1
vote
2 answers
html_safe in ruby on rails not working
I'm using ruby 2.0.0
This is my controller..
@mail_msg = @store_items.where(id: params[:button_id]).first.email_confirmation_text
p "-------------------------"
p @mail msg
p @mail_msg.html_safe
This is my console(terminal)…

Nidhin S G
- 1,685
- 2
- 15
- 45
1
vote
1 answer
How to include html coming from wysihtml5 in a view?
I have text content prepared using the wysihtml5 gem, which I would like to show in a div. Question is how to "render" this text content, as to be "safe". Should I use
= text.html_safe
or
= simple_format(text)
or
= raw(text)
or...

Danny
- 5,945
- 4
- 32
- 52
1
vote
0 answers
Raw and html_safe not working with Rails 4.0
I'm using first time gem "bootstrap-wysihtml5-rails". Before i was on ckeditor and both of these tags working fine with ckeditor. But not this case with bootstrap-wysihtml5-rails.
See screenshot of my form
Also see results with "raw". You can…

Kashiftufail
- 10,815
- 11
- 45
- 79
1
vote
2 answers
render html on popover via twitter bootstrap
I can not render the html placed inside my yml file as data attribute of a generic popover . I'm going to render the text field in this way:
= f.text_field :link_url, :class => "span6 popoverable", :data => {:content =>…

Mattia Lipreri
- 953
- 1
- 16
- 30
1
vote
1 answer
Form a html_safe string in rails
link_to "hi",content_tag(:p,"hello")
produces me
"hi"
i don't want the escaped output. how to get a html_safe string?

yednamus
- 582
- 1
- 4
- 22