Skip to content

Instantly share code, notes, and snippets.

@dwickwire
Created December 15, 2010 20:13
Show Gist options
  • Save dwickwire/742536 to your computer and use it in GitHub Desktop.
Save dwickwire/742536 to your computer and use it in GitHub Desktop.
def select_lookup(val, select)
return nil if val.nil? || val.blank?
from_select = select.find{|s| s.include? val}
return (!from_select.nil?) ? from_select[0] : val
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment