mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge pull request #3578 from amatsuda/remove_j_alias_for_json_escape
Remove j alias for ERB::Util.json_escape
This commit is contained in:
commit
d65a15dca6
1 changed files with 0 additions and 7 deletions
|
@ -60,18 +60,11 @@ class ERB
|
|||
# json_escape('{"name":"john","created_at":"2010-04-28T01:39:31Z","id":1}')
|
||||
# # => {name:john,created_at:2010-04-28T01:39:31Z,id:1}
|
||||
#
|
||||
# This method is also aliased as +j+, and available as a helper
|
||||
# in Rails templates:
|
||||
#
|
||||
# <%=j @person.to_json %>
|
||||
#
|
||||
def json_escape(s)
|
||||
result = s.to_s.gsub(JSON_ESCAPE_REGEXP) { |special| JSON_ESCAPE[special] }
|
||||
s.html_safe? ? result.html_safe : result
|
||||
end
|
||||
|
||||
alias j json_escape
|
||||
module_function :j
|
||||
module_function :json_escape
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue