render views from outside of controller for example in my modules in Lib directory

i render view from outside of controllers in my a module in lib folder, here is my render method:

      def render(options, assigns = {})         view = ActionView::Base.new (ActionController::Base.view_paths,assigns)         view.render options       end

and i call it like this: render(:file=>"#{template_path}.html.erb",:locals => locals)

every things fine in rendered page, i can use locals but when i use FORM_FOR in rendered view, i get this error message:

You have a nil object when you didn't expect it! The error occurred while evaluating nil.url_for

please help me!