Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. *************************************************************************************************************
  2. * En RentalMonth crear un enum de nombre charge_type, con los valores :advance, :first_payment y :rent_pay *
  3. * *
  4. * enum :charge_type, [:advance, :first_payment, :rent_pay] *
  5. *************************************************************************************************************
  6. *************************************************************************************************************
  7. * para crear un nuevo registro de renta *
  8. * *
  9. * user = User.first *
  10. * user_id = user.id *
  11. * Home.last *
  12. * home_id = home.id *
  13. * rent = Rent.new *
  14. * rent.user_id = user_id *
  15. * rent.home_id = home_id *
  16. * rent.day = ("Viernes") *
  17. * rent.start_date = Date.new(2019,8,9) *
  18. * rent.ending_date = Date.new(2019,9,9) *
  19. * rent.price_rent = 250 *
  20. * rent.save *
  21. *************************************************************************************************************
  22.  
  23. ***********************************************************************
  24. * para crear dos rental_month al registro de renta antes creado *
  25. * *
  26. * rent_id = rent.id *
  27. * rental_month = RentalMonth.new *
  28. * rental_month.price_rent = 250 *
  29. * rental_month.status = :paid *
  30. * rental_month.charge_type = :rent_pay *
  31. * rental_month.rent_id = rent_id *
  32. * rental_month.save *
  33. ***********************************************************************
  34.  
  35. *****************************************************************************************************************
  36. * Para actualizar el precio de una renta en específica por medio del id, y todos los amount de los rental months *
  37. * *
  38. * rent = Rent.find('5d4dab47955cdd0f8ed671e3') *
  39. * rent.price_rent = 5000 *
  40. * rent.save *
  41. * *
  42. * rental_months = RentalMonth.rent_pay.where(rent_id: '5d4dab47955cdd0f8ed671e3') *
  43. * rental_months.each{|data| data.price_rent = 5000} *
  44. * rental_months.each{|data| data.save} *
  45. *******************************************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement