Hi again, 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 :) def new_departure_attributes=(departure_attributes) departure_attributes.each do |attributes| departures.build(attributes) end end def existing_departure_attributes=(departure_attributes) departures.reject(&:new_record?).each do |departure| attributes = departure_attributes[departure.id.to_s] if attributes departure.attributes = attributes else departures.delete(departure) end end end def save_departures departures.each do |departure| departure.save(false) end end Can anyone educate me a bit? :) Thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---