Title says it all. It's pretty easy from controllers - just using "view_context". But it doesn't work with models.
E.g ApplicationController.new.view_context.url_for
yields in: "undefined method 'host' for nil:NilClass"
ActionView::Base.new(Rails.configuration.paths["app/views"].first).url_for
doesn't work as well.
Can this be done without so much pain ?
P.S I need it for my Prawn gem! I wanted to generate the PDF from the model. And apart from generating the links inside of it - it is very successful!
Hope for your help! Thanks in advance!