0

I try should get button_to but with no qoutes

while rendering

button_to "Delete",
  radio_tag_path(tag),
  :method=>:delete,
  :class=>:destroy,
  :confirm=>"Are you 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 you sure?" type="submit" value="Delete" />
    <input name="authenticity_token" type="hidden" value="eXM0McnTzuhnYIxrLLYF7kjp76fdMdZpq6HPc++ogog=" />
  </div>
</form>

but i need with no qoutes

than i rendered

(button_to "Delete",
  radio_tag_path(tag),
  :method=>:delete,
  :class=>:destroy,
  :confirm=>"Are you sure?"
).gsub('\"','\'')

but then the output is like 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 you 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 i remove the quotes but still use the html tags

jvnill
  • 29,479
  • 4
  • 83
  • 86
24sharon
  • 1,859
  • 7
  • 40
  • 65
  • why do you want to replace the double quotes? – jvnill Aug 26 '13 at 07:21
  • Are you saying you want to remove all quotes around the tag attributes? While some of these would be valid HTML without quotes, you would have invalid HTML if you removed all the quotes? What are you trying to achieve by doing this? – Planty Aug 26 '13 at 07:21
  • The answer seems simple, but why to do this? – Bigxiang Aug 26 '13 at 07:34

1 Answers1

1

You need to correct two things:

  • gsub call to match doublequotes
  • mark the output as html safe

Like that:

button_to("Delete", radio_tag_path(tag),
  :method=>:delete, :class=>:destroy, :confirm=>"Are you sure?"
).gsub('"','\'').html_safe
jurglic
  • 3,599
  • 1
  • 17
  • 13