Skip to content

Instantly share code, notes, and snippets.

@joshuaclayton
Created July 23, 2008 13:33
Show Gist options
  • Save joshuaclayton/1722 to your computer and use it in GitHub Desktop.
Save joshuaclayton/1722 to your computer and use it in GitHub Desktop.
def merge_options(options, extra_options)
(options.keys + extra_options.keys).uniq.each do |key|
merge = options[key] && extra_options[key]
if key == :conditions && merge
options[key] = merge_conditions(extra_options[key], options[key])
elsif key == :include && merge
options[key] = merge_includes(options[key], extra_options[key]).uniq
else
options[key] = options[key] || extra_options[key]
end
end
options
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment