Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 59 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. ########Viewer
  2.  
  3. <% form_for :card, :url => {:action => "generate"} do |f| -%>
  4.   <p>Number of cards<br /><%= f.text_field :number_of_cards, :size => 10 %></p>
  5.  
  6.   <%= submit_tag 'Generate' %>
  7. <% end -%>
  8.  
  9. ############Controller
  10.  
  11. def generate
  12.   number_of_cards.times do
  13.     pin    = rand(999999999999).to_s.center(12, rand(9).to_s)
  14.     serial = rand(999999999999).to_s.center(12, rand(9).to_s)
  15.     Card.create({:pin => pin, :serial => serial})
  16.   end
  17. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top