Question

I use the following Stripe form

 <% if @user.stripe_card_token? %>
  Credit Card is on File
 <% else %>
  <div class="col-md-4">
   <div class="form-group">
    <%= label_tag :card_number, "Credit Card Number" %>
    <%= text_field_tag :card_number, nil, name: nil, class: "input-lg form-control" %>
   </div>
  </div>
  <div class="col-md-6">
   <div class="form-group">
    <%= label_tag :card_month, "Card Expiration" %>
    <%= select_month nil, {add_month_numbers: true}, {name: nil, id: "card_month", class: "input-lg"} %>
    <%= select_year nil, {start_year: Date.today.year, end_year: Date.today.year+15}, {name: nil, id: "card_year", class: "input-lg"} %>
   </div>
  </div>
  <div class="col-md-2">
   <div class="form-group">
    <%= label_tag :card_code, "CVV" %>
    <%= text_field_tag :card_code, nil, name: nil, class: "input-lg form-control" %>
   </div>
  </div>
 <% end %>

I wish to change the select_month input in a way that when it renders to show only months numbers and not months names.

Right now it renders like that:

enter image description here

Any clues? Thank you.

Was it helpful?

Solution

As per the doc http://apidock.com/rails/ActionView/Helpers/DateHelper/select_month

Remove the options add_month_numbers: true and replace it by use_month_numbers: true

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top