From 8030dfa9b459f9f1790fac04ebc523b7876b19a8 Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 2 Sep 2010 16:16:27 -0300 Subject: [PATCH] Fix port issue with development server in background --- lib/noosfero.rb | 10 +--------- vendor/plugins/noosfero_urls/init.rb | 5 +++++ 2 files changed, 6 insertions(+), 9 deletions(-) create mode 100644 vendor/plugins/noosfero_urls/init.rb diff --git a/lib/noosfero.rb b/lib/noosfero.rb index e771fd7..a29a8f2 100644 --- a/lib/noosfero.rb +++ b/lib/noosfero.rb @@ -68,16 +68,8 @@ module Noosfero end end - # FIXME couldn't think of a way to test this. - # - # Works (tested by hand) on Rails 2.0.2, with mongrel. Should work with - # webrick too. def self.development_url_options - if Object.const_defined?('OPTIONS') - { :port => OPTIONS[:port ]} - else - {} - end + @development_url_options || {} end diff --git a/vendor/plugins/noosfero_urls/init.rb b/vendor/plugins/noosfero_urls/init.rb new file mode 100644 index 0000000..60b2a14 --- /dev/null +++ b/vendor/plugins/noosfero_urls/init.rb @@ -0,0 +1,5 @@ +if Rails.env == 'development' + ActionController::Base.send(:prepend_before_filter) do |controller| + Noosfero.instance_variable_set('@development_url_options', { :port => controller.request.port }) + end +end -- libgit2 0.21.2