I'm trying to grab the full HTML of a webpage when saving a URL. Here is my model where I'd tried to have a go at writing the method.
class Page < ActiveRecord::Base
def processPages(page_url)
open(page_url) do |uri|
html = uri.read
create!( html => page.html )
end
end
end
I'm trying to put the raw html which exists in html into a property of my page object, but can't get my head around how to save the content.
I'm also struggling to call processPages from within my controller on the create action which at the moment is basic scaffolding.