Skip to content

Instantly share code, notes, and snippets.

@hexgnu
Created February 3, 2012 02:44
Show Gist options
  • Save hexgnu/1727309 to your computer and use it in GitHub Desktop.
Save hexgnu/1727309 to your computer and use it in GitHub Desktop.
gnip_rules.clear
rule_types.each do |rule_type|
existing_rules = rule_type.find_all_by_value(rule_values)
new_rules = (rule_values - existing_rules.map(&:value)).map{|value| rule_type.create(:value => value) }
gnip_rules << existing_rules + new_rules
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment