Como definir config.action_controller.default_url_options = {: host = '#' '} conforme o ambiente

gora, estou usando isso que funciona para o host de desenvolvimento, mas preciso alterar manualmente o código {: host => ""} quando passar para a produçã

post.rb
def share_all
  url =  Rails.application.routes.url_helpers.post_url(self, :host => 'localhost:3000')
  if user.authentications.where(:provider => 'twitter').any?
    user.twitter_share(url)  
  end
end

Gostaria de usar isso e depois definir o default_url_options por ambiente:

post.rb
def share_all
  url =  Rails.application.routes.url_helpers.post_url(self)
  if user.authentications.where(:provider => 'twitter').any?
    user.twitter_share(url)  
  end
end

Tentei adicionar isso ao meu config / environment / development.rb, mas ainda recebo o "Host ausente para vincular! Forneça: parâmetro host ou defina o erro default_url_options [: host]"

development.rb
config.action_controller.default_url_options = {:host => "localhost:3000"}

E até tentei assim:

development.rb
config.action_controller.default_url_options = {:host => "localhost", :port => "3000"}

EDITAR

Eu também já segui isso e continua o mesmo guia de erroshttp: //edgeguides.rubyonrails.org/action_controller_overview.html#default_url_option

application controller
class ApplicationController < ActionController::Base
  protect_from_forgery
  include ApplicationHelper
  def default_url_options
    if Rails.env.production?
      { :host => "example.com"}
    else
      {:host => "example1.com"}
    end
  end
end

Isto está me deixando louco, o que estou perdendo aqui ???

questionAnswers(4)

yourAnswerToTheQuestion