I have this model, trip.rb, which is getting bloated with the same
things repeated all over. I'm new to both rails and ruby so I'm
looking for help on how to DRY this thing a bit
I basically have to repeat this a lot of time (replacing "departure"
and "departures" with other models) and I would love to find a way to
write it once
departure_attributes.each do |attributes|
departures.reject(&:new_record?).each do |departure|
attributes = departure_attributes[departure.id.to_s]
departure.attributes = attributes
departures.each do |departure|
Can anyone educate me a bit?