How to remove element from array (ActiveRecord)?

i have a record
NormalReservation.last

=> #<NormalReservation id: 34, name: nil, family_id: 3, location_id: 1, ticket_no: nil, from_date: “2019-07-16”, to_date: nil, from_time: “19:00:00”, to_time: “19:30:00”, created_at: “2019-07-16 12:43:14”, updated_at: “2019-07-16 12:43:14”, kids_ids: [23, 6], reservation_type: “normal_reservation”, payer_id: nil, payer_employer_id: nil, infant_present: false, first_name: nil, last_name: nil, recurring: 0, recurring_end_date: nil, toddler_present: false, infant_and_toddler_present: false, common_recurring_id: nil, young_toddler_present: false, has_atleast_one_infant: false, has_atleast_one_young_toddler: true, has_atleast_one_toddler: false, has_atleast_one_preschooler: true, has_atleast_one_schooler: false, used_reservation: false, infant_count: 0, young_toddler_count: 1, toddler_count: 0, preschooler_count: 1, schooler_count: 0, remaining_visit_id: nil>

Now you can see the kids_ids column
have two element now i want to delete 23
i am trying this NormalReservation.last.kids_ids.delete(23) but not working

Try .destroy rather than .delete

I’m not sure if that will help though as I’m new to ruby myself

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs