rails button_to replace quotes with single quoute -
i try should button_to no qoutes
while rendering
button_to "delete", radio_tag_path(tag), :method=>:delete, :class=>:destroy, :confirm=>"are sure?"
the output is
<form action="/radio/tags/654" class="button_to" method="post"> <div> <input name="_method" type="hidden" value="delete" /> <input class="destroy" data-confirm="are sure?" type="submit" value="delete" /> <input name="authenticity_token" type="hidden" value="exm0mcntzuhnyixrllyf7kjp76fdmdzpq6hpc++ogog=" /> </div> </form>
but need no qoutes
than rendered
(button_to "delete", radio_tag_path(tag), :method=>:delete, :class=>:destroy, :confirm=>"are sure?" ).gsub('\"','\'')
but output html_safe
<form action="/radio/tags/654" class="button_to" method="post"><div><input name="_method" type="hidden" value="delete" /><input class="destroy" data-confirm="are sure?" type="submit" value="delete" /><input name="authenticity_token" type="hidden" value="exm0mcntzuhnyixrllyf7kjp76fdmdzpq6hpc++ogog=" /></div></form>
how can remove quotes still use html tags
you need correct 2 things:
- gsub call match doublequotes
- mark output html safe
like that:
button_to("delete", radio_tag_path(tag), :method=>:delete, :class=>:destroy, :confirm=>"are sure?" ).gsub('"','\'').html_safe
Comments
Post a Comment