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

&lt;form action=&quot;/radio/tags/654&quot; class=&quot;button_to&quot; method=&quot;post&quot;&gt;&lt;div&gt;&lt;input name=&quot;_method&quot; type=&quot;hidden&quot; value=&quot;delete&quot; /&gt;&lt;input class=&quot;destroy&quot; data-confirm=&quot;are sure?&quot; type=&quot;submit&quot; value=&quot;delete&quot; /&gt;&lt;input name=&quot;authenticity_token&quot; type=&quot;hidden&quot; value=&quot;exm0mcntzuhnyixrllyf7kjp76fdmdzpq6hpc++ogog=&quot; /&gt;&lt;/div&gt;&lt;/form&gt; 

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

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -