From cddbff5b32ea1f7f204f93169fce897030a7760f Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 8 Jul 2010 21:29:03 -0300 Subject: [PATCH] New logic for setting :port in development mode --- app/helpers/tags_helper.rb | 2 +- lib/noosfero.rb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index fef502a..906e116 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -51,7 +51,7 @@ module TagsHelper style = ""+ "font-size: #{ (v * delta).round + min_size }px;"+ "top: #{ -(delta/2) - (v * (delta/2)).round }px;" - destination = url.kind_of?(Hash) ? url_for(url.merge(tagname_option => tag)) : (url.to_s + tag) + destination = url.merge(tagname_option => tag) if options[:show_count] display_count = options[:show_count] ? "(#{count})" : "" diff --git a/lib/noosfero.rb b/lib/noosfero.rb index e93c6ff..7ee3fdd 100644 --- a/lib/noosfero.rb +++ b/lib/noosfero.rb @@ -60,16 +60,16 @@ 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 ||= + begin + options = { :port => 3000 } + config = File.join(Rails.root, 'config', 'url_options.yml') + if File.exists?(config) + options.merge!(YAML.load_file(config).symbolize_keys) + end + options + end end -- libgit2 0.21.2