What's your rating of RailsCasts
I'm watching this Railscast episode and wonder why the call is needed here:
What is it used for?
According to the Rails documents:
But that doesn't mean much to me.
It's easier to understand when you break the code into two parts.
So what if our part contains simple HTML like this?
To prevent this from happening, you want this special character escape so that your string is not truncated. Instead, you need something that will generate this:
Users can post malicious code (malicious users) that, if not hijacked, could run, giving users control of your application.
I'm not really familiar with the syntax of rails, but if you don't escape you will see a warning message and I don't think this is behavior by design.
If you look at the source here, it becomes a lot clearer.
This function does the following two things:
It replaces the characters in the input string with those defined in JS_ESCAPE_MAP
- The function also checks whether the resulting string is HTML-safe. If not, the necessary escape character is performed to ensure that the string becomes HTML safe and returns the result.
Even so, I am not denying that script injection is not an option. To avoid this, you need to take steps when storing the user data in your database. The function and example you provided are for rendering the information that has already been saved.
I hope this helps and answers your question.
- Are there swords without handles?
- How are astronomical models so accurately predicted
- Email content marketing is dying
- Is it safe to join Zensar
- How can we send large files for free
- Which cell phone does MS Dhoni use
- India's demonetization experiment has succeeded
- Can you list UGC NET scholarships
- Can you choke ants
- Has Twitter ever experienced a software failure?
- What events led to the European exploration
- Gay Koreans like foreigners
- Actually carry boxes
- What is a chemical bond
- Salad can be offered while sitting
- Thomas Jefferson had brothers
- What is the rational justification for kindness
- Java supports a multidimensional array
- Who became king after Bindusar
- Does the Mozart Effect really work
- The water temperature can exceed the boiling point
- Does psychedelic music work
- How does a vacuum transistor work
- Obama was seen as a weak president