Skip to content

Instantly share code, notes, and snippets.

@atleastimtrying
Last active December 16, 2015 17:09
Show Gist options
  • Save atleastimtrying/5468463 to your computer and use it in GitHub Desktop.
Save atleastimtrying/5468463 to your computer and use it in GitHub Desktop.
Drying this up
def regions_with_country_ids_for_select(collection)
response = []
collection.each do |item|
response << [item.name, item.id, :"data-parent_id" => region.country_id]
end
response
end
def referral_origins_for_select(collection)
response = []
collection.each do |item|
response << [item.name, item.id, :"data-parent_id" => referral_origin.referral_id]
end
response
end
def dependent_options(collection, label)
response = []
collection.each do |item|
response << [item.name, item.id, :"data-parent_id" => item[label]]
end
response
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment