what does the "h" in <%=h ... %> means? Example: <%=h category.send(column.name) %> It seems like I can do with or without the "h".
h() is an alias for html_escape() (though I can''t find it in the trunk easily) It escapes the HTML (turns " into ") -M On Jul 2, 2005, at 2:24 AM, Sumwai Low wrote:> what does the "h" in <%=h ... %> means? > > Example: <%=h category.send(column.name) %> > > It seems like I can do with or without the "h". > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails > >Matt Pelletier pelletierm-A1PILTyJ15gXhy9q4Lf3Ug@public.gmane.org
h is an alias for escapehtml see: http://wiki.rubyonrails.com/rails/show/HowToEscapeHTML On 7/1/05, Sumwai Low <waye2k-PkbjNfxxIARBDgjK7y7TUQ@public.gmane.org> wrote:> what does the "h" in <%=h ... %> means? > > Example: <%=h category.send(column.name) %> > > It seems like I can do with or without the "h". > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
h() and html_escape() is part of ERb, not Rails. It actually does the following gsubs: gsub(/&/, "&").gsub(/\"/, """).gsub(/>/, ">").gsub(/</, "<") Lucas Carlson http://tech.rufy.com/ On Jul 1, 2005, at 11:48 PM, Matt Pelletier wrote:> h() is an alias for html_escape() (though I can''t find it in the > trunk easily) > > It escapes the HTML (turns " into ") > > -M > > On Jul 2, 2005, at 2:24 AM, Sumwai Low wrote: > > >> what does the "h" in <%=h ... %> means? >> >> Example: <%=h category.send(column.name) %> >> >> It seems like I can do with or without the "h". >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> >> >> > > Matt Pelletier > pelletierm-A1PILTyJ15gXhy9q4Lf3Ug@public.gmane.org > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >