Im trying to set the default_url_options on a per environment basis
but nothing is working. I keep getting “Missing host to link to!
Please provide :host parameter or set default_url_options[:host]”
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
I’ve tried adding this to my config/environments/development.rb :
development.rb
config.action_controller.default_url_options = {:host => “localhost:
3000”}
which didn’t work so I tried it this way:
development.rb
config.action_controller.default_url_options = {:host =>
“localhost”, :port => 3000}
And that didnt work so I tried just defining the method in the
application controller but it didnt work either.
class ApplicationController < ActionController::Base
protect_from_forgery
include ApplicationHelper
def default_url_options
{ :host => “example.com”}
end
end
What am I missing here? This is driving me nuts, thanks.