From contact at robl.me Wed Jun 3 05:25:04 2009 From: contact at robl.me (Rob Lacey) Date: Wed, 03 Jun 2009 10:25:04 +0100 Subject: [Facebooker-talk] Bug in Facebooker::Rails::Publisher Message-ID: <4A264170.10306@robl.me> Hi there, I've been trying to use the Facebooker::Rails::Publisher inside a plugin and I noticed rendering views doesn't work since the view paths are always app/views:app/views/ It appears that despite appending the view_paths to ActionController::Base that the view paths that are passed to ActionView::Base.new are [template_root, controller_root]. This means any appended view_paths within the Rails application, and in my case the plugin view paths, are missing. I fixed my problem by changing this from ActionView::Base.new([template_root,controller_root], assigns, self) to ActionView::Base.new(ActionController::Base.view_paths, assigns, self) def initialize_template_class(assigns) template_root = "#{RAILS_ROOT}/app/views" controller_root = File.join(template_root,self.class.controller_path) #only do this on Rails 2.1 if ActionController::Base.respond_to?(:append_view_path) # only add the view path once unless ActionController::Base.view_paths.include?(controller_root) ActionController::Base.append_view_path(controller_root) ActionController::Base.append_view_path(controller_root+"/..") end end returning ActionView::Base.new([template_root,controller_root], assigns, self) do |template| template.controller=self template.extend(self.class.master_helper_module) def template.request_comes_from_facebook? true end end end end I'm not sure what a more permanent solution would be. Any ideas? RobL http://www.robl.me From mmangino at elevatedrails.com Wed Jun 3 09:27:25 2009 From: mmangino at elevatedrails.com (Mike Mangino) Date: Wed, 3 Jun 2009 09:27:25 -0400 Subject: [Facebooker-talk] Bug in Facebooker::Rails::Publisher In-Reply-To: <4A264170.10306@robl.me> References: <4A264170.10306@robl.me> Message-ID: <4AF1CBB7-9D4F-4918-9A5D-8C3BC7FFD575@elevatedrails.com> That looks like a good fix. Does that work for views in the folder of the publisher? If so, send me a pull request on github to make sure you get credit for the change. Mike On Jun 3, 2009, at 5:25 AM, Rob Lacey wrote: > Hi there, > > I've been trying to use the Facebooker::Rails::Publisher inside a > plugin and I noticed rendering views doesn't work since the view > paths are always app/views:app/views/ > > It appears that despite appending the view_paths to > ActionController::Base that the view paths that are passed to > ActionView::Base.new are [template_root, controller_root]. This > means any appended view_paths within the Rails application, and in > my case the plugin view paths, are missing. > > I fixed my problem by changing this from > ActionView::Base.new([template_root,controller_root], assigns, self) > to > ActionView::Base.new(ActionController::Base.view_paths, assigns, self) > > def initialize_template_class(assigns) > template_root = "#{RAILS_ROOT}/app/views" > controller_root = > File.join(template_root,self.class.controller_path) > #only do this on Rails 2.1 > if ActionController::Base.respond_to?(:append_view_path) > # only add the view path once > unless ActionController::Base.view_paths.include? > (controller_root) > ActionController::Base.append_view_path(controller_root) > ActionController::Base.append_view_path(controller_root > +"/..") > end > end > returning > ActionView::Base.new([template_root,controller_root], assigns, self) > do |template| > template.controller=self > template.extend(self.class.master_helper_module) > def template.request_comes_from_facebook? > true > end > end > end > > end > > I'm not sure what a more permanent solution would be. Any ideas? > > RobL > http://www.robl.me > _______________________________________________ > Facebooker-talk mailing list > Facebooker-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/facebooker-talk -- Mike Mangino http://www.elevatedrails.com From contact at robl.me Wed Jun 3 10:32:32 2009 From: contact at robl.me (Rob Lacey) Date: Wed, 03 Jun 2009 15:32:32 +0100 Subject: [Facebooker-talk] Bug in Facebooker::Rails::Publisher In-Reply-To: <4AF1CBB7-9D4F-4918-9A5D-8C3BC7FFD575@elevatedrails.com> References: <4A264170.10306@robl.me> <4AF1CBB7-9D4F-4918-9A5D-8C3BC7FFD575@elevatedrails.com> Message-ID: <4A268980.5010506@robl.me> It does work for views in the folder of the publisher. I did look at writing the test for the rendering partials as there doesn't appear to be one only rendering inline. Although I am not quite sure how you're testing this as the test RAILS_ROOT appears to be at the same depth as the plugin e.g ./app/views/test/_publisher.erb ./facebooker Shouldn't the test RAILS_ROOT be somewhere like test/rails_root/ or something? I have pushed my changes, I'll send you over a pull request shortly http://github.com/braindeaf/facebooker/tree/master RobL http://www.robl.me Mike Mangino wrote: > That looks like a good fix. Does that work for views in the folder of > the publisher? If so, send me a pull request on github to make sure > you get credit for the change. > > Mike > > On Jun 3, 2009, at 5:25 AM, Rob Lacey wrote: > >> Hi there, >> >> I've been trying to use the Facebooker::Rails::Publisher inside a >> plugin and I noticed rendering views doesn't work since the view >> paths are always app/views:app/views/ >> >> It appears that despite appending the view_paths to >> ActionController::Base that the view paths that are passed to >> ActionView::Base.new are [template_root, controller_root]. This means >> any appended view_paths within the Rails application, and in my case >> the plugin view paths, are missing. >> >> I fixed my problem by changing this from >> ActionView::Base.new([template_root,controller_root], assigns, self) >> to >> ActionView::Base.new(ActionController::Base.view_paths, assigns, self) >> >> def initialize_template_class(assigns) >> template_root = "#{RAILS_ROOT}/app/views" >> controller_root = >> File.join(template_root,self.class.controller_path) >> #only do this on Rails 2.1 >> if ActionController::Base.respond_to?(:append_view_path) >> # only add the view path once >> unless >> ActionController::Base.view_paths.include?(controller_root) >> ActionController::Base.append_view_path(controller_root) >> ActionController::Base.append_view_path(controller_root+"/..") >> end >> end >> returning ActionView::Base.new([template_root,controller_root], >> assigns, self) do |template| >> template.controller=self >> template.extend(self.class.master_helper_module) >> def template.request_comes_from_facebook? >> true >> end >> end >> end >> >> end >> >> I'm not sure what a more permanent solution would be. Any ideas? >> >> RobL >> http://www.robl.me >> _______________________________________________ >> Facebooker-talk mailing list >> Facebooker-talk at rubyforge.org >> http://rubyforge.org/mailman/listinfo/facebooker-talk > > -- > Mike Mangino > http://www.elevatedrails.com > > > From yarnosh at gmail.com Tue Jun 30 10:47:25 2009 From: yarnosh at gmail.com (Matthew Isleb) Date: Tue, 30 Jun 2009 09:47:25 -0500 Subject: [Facebooker-talk] Absolute paths? Message-ID: Hi, I noticed that after install Facebooker into an existing rails app, all of my asset URIs are now absolute paths through the Facebook canvas URL. The problem is that Faceook integration is only a small part of my app. I don't want all resources to go through my tunnel when developing. And I don't want to require other developers to setup the facebook tunnel when they are not touching any of the Facebook portions. Is there any way to turn the javascript/css/img paths back to relative URLs for regular HTML pages? Only FBML should use the canvas URL. -matthew