Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. 1.2.3.) Account model [belongs_to :customer, has_many :offers, through: services]
  2. - customer_id [references/int]
  3. - saldo [decimal - 9,2]
  4. - status [string] [active / blocked]
  5. - block_reason [string]
  6. - db_name
  7. - db_user
  8. - db_password
  9.  
  10. 1.2.4.) Service model [belongs_to :offer]
  11. - service_name [string] [sale / crm / schedule]
  12. - offer_id [references/int]
  13.  
  14. 1.2.5.) Offer model [has_many :services]
  15. - name [string]
  16. - service_name [string] [sale / crm / schedule]
  17. - limits [hstore]
  18.  
  19. Example scenario:
  20. - table offers
  21. id: 1, name: "Winter offer for crm", service_name: "crm", limits: {contacts_limit: 5}
  22. id: 2, name: "Winter offer for sale", service_name: "sales", limits: {sales_limit: 100}
  23.  
  24. - table services:
  25. id: 1, service_name: "crm", offer_id: 1
  26. id: 2, service_name: "sales", offer_id: 2
  27.  
  28. - table account_services:
  29. id: 1, account_id: 1, service_id: 1
  30. id: 2, account_id: 1, service_id: 2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement