Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created June 6, 2012 22:38
Show Gist options
  • Select an option

  • Save Heavyblade/2885271 to your computer and use it in GitHub Desktop.

Select an option

Save Heavyblade/2885271 to your computer and use it in GitHub Desktop.
def update_auth_record
return true if ["test","development"].include?(Rails.env) or @no_update
begin
keymanager_call "update", { 'clientapp[icon_medium]' => (ENV['ENABLERS_HOST'] + self.icon.url(:medium)),
'clientapp[icon_thumb]' => (ENV['ENABLERS_HOST'] + self.icon.url(:thumb))}
true
rescue RestClient::InternalServerError => e
result = Nokogiri::XML(e.http_body)
if result.xpath('//consumer/clientapp/error/message').text =~ /Name has already been taken/
errors.add(:name, :not_unique)
else
errors[:base] << "Unable to connect to key manager. Please try again later"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment