daily pastebin goal
2%
SHARE
TWEET

Untitled

a guest Mar 14th, 2018 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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