Skip to content

Commit

Permalink
Fix to url handling in publisher
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://rubyforge.org/var/svn/facebooker/trunk/facebooker@205 06148572-b36b-44fe-9aa8-f68b04d8b080
  • Loading branch information
mmangino committed Mar 14, 2008
1 parent d9a7769 commit 1824ebe
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/facebooker/rails/publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -184,34 +184,38 @@ def logger
# nodoc
# delegate to action view. Set up assigns and render
def render(opts)
opts = opts.dup
body = opts.delete(:assigns) || {}
initialize_template_class(body).render(opts)
initialize_template_class(body.dup.merge(:controller=>self)).render(opts)
end


def initialize_template_class(assigns)
template_root = "#{RAILS_ROOT}/app/views/"
returning ActionView::Base.new([template_root,File.join(template_root,self.class.controller_path)], assigns, self) do |template|
template.controller=self
template.extend(self.class.master_helper_module)
end
end


self.master_helper_module = Module.new
self.master_helper_module.module_eval do
# url_helper delegates to @controller,
# so we need to define that in the template
# we make it point to the publisher
include ActionView::Helpers::UrlHelper
include ActionController::UrlWriter # This must come after the include for
# ActionView::Helpers::UrlHelper or
# else url_for gets overridden
include ActionView::Helpers::TextHelper
include ActionView::Helpers::TagHelper
include ActionView::Helpers::FormHelper
include ActionView::Helpers::FormTagHelper
include ActionView::Helpers::AssetTagHelper
include Facebooker::Rails::Helpers
end
ActionController::Routing::Routes.named_routes.install(self.master_helper_module)
include self.master_helper_module

# Publisher is the controller, it should do the rewriting
include ActionController::UrlWriter
class <<self


Expand Down

0 comments on commit 1824ebe

Please sign in to comment.