class Stall::Addresses::PrefillTargetFromSource
Public Instance Methods
copy()
click to toggle source
# File lib/stall/addresses/prefill_target_from_source.rb, line 4 def copy prefill_address(:shipping) prefill_address(:billing) end
Private Instance Methods
prefill_address(type)
click to toggle source
# File lib/stall/addresses/prefill_target_from_source.rb, line 11 def prefill_address(type) source.with_actual_address_associations do target.with_actual_address_associations do source_address = source.send("#{ type }_address") if source_address && !target.send("#{ type }_address?") attributes = duplicate_attributes(source_address) target.send("build_#{ type }_address", attributes) elsif !target.send("#{ type }_address?") target.send("build_#{ type }_address") end end end end