To Examples

CreditCard Directions

 

  1. Create a new rails project named CreditCard.
     
  2. Navigate to the CreditCard folder.
     
  3. Generate a model named Order with these fields:
     
    Field Datatype
    name string
    phone string
    amount float
    card_type string
    card_no string
    exp_date date

     
  4. Enter this rake statement to create the database:
  5. Generate a controller with name Orders with views new_order and display_orders.
     
  6. Use this code for the controller orders_controller.rb.
     
  7. Use this code for the views new_order.html.erb and display_order.html.erb.
     
  8. Add a post route to the config/routes.rb file:
  9. Add a layout page and a CSS style file.
     
  10. View the display_orders view in a browser at this URL: