title: Change form input attribute 'name' to 'data-encrypted-name' in Rails forms
body: <p><a href="https://stackoverflow.com/questions/18116917/change-form-input-attribute-name-to-data-encrypted-name/18117395">Change form input attribute &#39;name&#39; to &#39;data-encrypted-name&#39;</a> discusses Django, but this question is about Rails. </p>
  
  <p>I created a form in Rails to handle credit card payments with Braintree. However, the encryption doesn't work because Rails adds name attributes to the forms. As per the <a href="https://www.braintreepayments.com/docs/ruby/guide/getting_paid#payment_form" rel="nofollow noreferrer">Braintree Docs</a>, I want to replace the name attributes with <code>data-encrypted-name</code> attributes. How do I do this? </p>
  
  <p>This (nested) form helper:</p>
  
  <pre><code>&lt;%= cc.text_field :number %&gt;
  </code></pre>
  
  <p>..creates the following element:</p>
  
  <pre><code> &lt;input id="credit_card_number" name="credit_card[number]" size="30" type="text"&gt;
  </code></pre>
  
  <p>How do I replace <code>name</code> with <code>data-encrypted-name</code>? </p>