Skip to content
Snippets Groups Projects
Commit 55280faa authored by pabois's avatar pabois
Browse files

Merge branch 'master' of github.com:noesya/osuny

parents 3d26a28a 4326d1ea
No related branches found
No related tags found
No related merge requests found
......@@ -26,6 +26,10 @@ class Users::RegistrationsController < Devise::RegistrationsController
protected
def sign_up(resource_name, resource)
sign_in(resource, event: :authentication)
end
def update_resource(resource, params)
resource.update(params)
end
......
......@@ -100,6 +100,7 @@ class Communication::Website::Imported::Post < ApplicationRecord
doc = Nokogiri::HTML(post.text.to_s)
images = doc.css('img')
if images.any?
begin
url = images.first.attr('src')
uri = URI(url)
filename = File.basename url
......@@ -107,9 +108,8 @@ class Communication::Website::Imported::Post < ApplicationRecord
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
begin
response = http.request(request)
post.featured_image.attach(io: StringIO.new(response.body), filename: filename, content_type: 'image/jpeg')
response = http.request(request)
post.featured_image.attach(io: StringIO.new(response.body), filename: filename, content_type: 'image/jpeg')
rescue
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment