Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. class Order < ApplicationRecord
  2. has_many :items
  3. accepts_nested_attributes_for :items
  4. end
  5.  
  6. class Item < ApplicationRecord
  7.  
  8.  
  9. belongs_to :order
  10.  
  11. end
  12.  
  13. {
  14. "location": "takeAway",
  15. "status": "preparing",
  16. "items": [
  17. {
  18. "id":2,
  19. "name": "coffee",
  20. "quantity": 1,
  21. "milk": "whole",
  22. "size": "small"
  23. }
  24. ]
  25. }
  26.  
  27. params.require(:order).permit(:location, :status, items_attributes: [:id, :name, :quantity, :milk, :size])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement