Skip to content

Instantly share code, notes, and snippets.

@pmaojo
Created May 24, 2017 19:56
Show Gist options
  • Save pmaojo/2bd434c1461febe7c36dd718cc2ee812 to your computer and use it in GitHub Desktop.
Save pmaojo/2bd434c1461febe7c36dd718cc2ee812 to your computer and use it in GitHub Desktop.
x38413
#...
after_save :facebookapplink
#...
private
require 'open-uri'
def facebookapplink
if self.facebook.present?
uri = URI.parse(self.facebook)
cuelpo = uri.read
respuesta = cuelpo.match(/\<[Mm][Ee][Tt][Aa] property\=\"al:ios:url\"\ content\=\"(.*?)\"[\s\/\>|\/\>]/)
if respuesta != nil
respuesta = respuesta[1].to_s
self.update_column(:mobileurl, respuesta)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment