{"action":"opened","issue":{"url":"https://api.github.com/repos/grantmnelson/charityapi/issues/5","labels_url":"https://api.github.com/repos/grantmnelson/charityapi/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/grantmnelson/charityapi/issues/5/comments","events_url":"https://api.github.com/repos/grantmnelson/charityapi/issues/5/events","html_url":"https://github.com/grantmnelson/charityapi/issues/5","id":129971593,"number":5,"title":"Validate ein numbers on models with ein numbers. ","user":{"login":"Grantimus9","id":5784418,"avatar_url":"https://avatars.githubusercontent.com/u/5784418?v=3","gravatar_id":"","url":"https://api.github.com/users/Grantimus9","html_url":"https://github.com/Grantimus9","followers_url":"https://api.github.com/users/Grantimus9/followers","following_url":"https://api.github.com/users/Grantimus9/following{/other_user}","gists_url":"https://api.github.com/users/Grantimus9/gists{/gist_id}","starred_url":"https://api.github.com/users/Grantimus9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Grantimus9/subscriptions","organizations_url":"https://api.github.com/users/Grantimus9/orgs","repos_url":"https://api.github.com/users/Grantimus9/repos","events_url":"https://api.github.com/users/Grantimus9/events{/privacy}","received_events_url":"https://api.github.com/users/Grantimus9/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-01-30T10:33:37Z","updated_at":"2016-01-30T10:33:37Z","closed_at":null,"body":"Example Code, for tax_id_number instead of ein though: \r\n\r\n```\r\ndef format_tax_id_number\r\n   self.tax_id_number = self.tax_id_number.gsub(/\\D/, '') unless self.tax_id_number.nil?\r\n end\r\n\r\n # Validates that the tax_id_number entered by the user has a known valid prefix.\r\n def validate_tax_id_prefix\r\n   # Data from https://www.irs.gov/Businesses/Small-Businesses-&-Self-Employed/How-EINs-are-Assigned-and-Valid-EIN-Prefixes\r\n   acceptable_prefixes = [\r\n    10, 12, 60, 67, 50, 53, 01, 02, 03, 04, 05, 06, 11, 13, 14, 16, 21, 22, 23,\r\n    25, 34, 51, 52, 54, 55, 56, 57, 58, 59, 65, 30, 32, 35, 36, 37, 38, 61, 15,\r\n    24, 40, 44, 94, 95, 80, 90, 33, 39, 41, 42, 43, 48, 62, 63, 64, 66, 68, 71,\r\n    72, 73, 74, 75, 76, 77, 81, 82, 83, 84, 85, 86, 87, 88, 91, 92, 93, 98, 99,\r\n    20, 26, 27, 45, 46, 47, 31\r\n   ]\r\n\r\n   acceptable_prefixes.map! { |p| p.to_s }\r\n\r\n   if !acceptable_prefixes.include?(self.tax_id_number[0,2])\r\n     errors.add(:tax_id_number, \"Check the Tax ID/EIN First Two Digits\")\r\n   end\r\n\r\n end\r\n\r\n def validate_tax_id_length\r\n   self.tax_id_number.gsub!(/\\D/, '')\r\n   if self.tax_id_number.length != 9\r\n     errors.add(:tax_id_number, \"Tax ID or EIN Number Should be 9 Digits\")\r\n   end\r\n end\r\n```"}}