Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- *************************************************************************************************************
- * En RentalMonth crear un enum de nombre charge_type, con los valores :advance, :first_payment y :rent_pay *
- * *
- * enum :charge_type, [:advance, :first_payment, :rent_pay] *
- *************************************************************************************************************
- *************************************************************************************************************
- * para crear un nuevo registro de renta *
- * *
- * user = User.first *
- * user_id = user.id *
- * Home.last *
- * home_id = home.id *
- * rent = Rent.new *
- * rent.user_id = user_id *
- * rent.home_id = home_id *
- * rent.day = ("Viernes") *
- * rent.start_date = Date.new(2019,8,9) *
- * rent.ending_date = Date.new(2019,9,9) *
- * rent.price_rent = 250 *
- * rent.save *
- *************************************************************************************************************
- ***********************************************************************
- * para crear dos rental_month al registro de renta antes creado *
- * *
- * rent_id = rent.id *
- * rental_month = RentalMonth.new *
- * rental_month.price_rent = 250 *
- * rental_month.status = :paid *
- * rental_month.charge_type = :rent_pay *
- * rental_month.rent_id = rent_id *
- * rental_month.save *
- ***********************************************************************
- *****************************************************************************************************************
- * Para actualizar el precio de una renta en específica por medio del id, y todos los amount de los rental months *
- * *
- * rent = Rent.find('5d4dab47955cdd0f8ed671e3') *
- * rent.price_rent = 5000 *
- * rent.save *
- * *
- * rental_months = RentalMonth.rent_pay.where(rent_id: '5d4dab47955cdd0f8ed671e3') *
- * rental_months.each{|data| data.price_rent = 5000} *
- * rental_months.each{|data| data.save} *
- *******************************************************************************************************************
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement