Trying to create an IMGKit instance in one of my Rails controllers:
def wkhtmltoimage
...
kit = IMGKit.new("http://#{request.host_with_port}/?auth_token=" + token)
img = kit.to_img(:jpg)
file = kit.to_file(Rails.root + "public/uploads/testimage.jpg")
...
end
When I load the page, I get this:
NameError in PagesController#wkhtmltoimage
uninitialized constant PagesController::IMGKit
In my Gemfile I’m including the proper gem:
gem 'imgkit'
Bundler installs it fine. When I run the Rails console it is there and works:
1.9.3p194 :005 > IMGKit.new("http://google.com")
=> #<IMGKit:0x007fb08d16a658 @source=http://google.com, @stylesheets=[], @options={}>
1.9.3p194 :006 >
Why would the class IMGKit work in the Rails console but not in the app? Any suggestions? Using RVM, Pow, Rails 3.2.6 (and all other gems work fine with that setup).
EDIT WITH ANSWER
Rebooting the pow server appears to have fixed the problem. Just put in terminal:
touch tmp/restart.txt
That should do it.
Rebooting the pow server appears to have fixed the problem. Just put in terminal:
That should do it.