Is there a way to manually specify the root url that a <%= link_to %> generates? So i can make an auto generated url that used to go to mywebsite.myhost.com/comments be go to example.com/comments ? The reason, if you''re wondering is that I have hosting at a site and my domain forwarded and masked through go-daddy. This means when you go to example.com you are seeing content on mywebsite.myhost.com but the url shows up as example.com. The problem comes when you click on a link for lets say comments, for whatever reason instead of showing example.com/comments in the url it just shows example.com. If you type example.com/comments directly into the address bar though, everything works great you get the content you expect and the url you expect. So how can i make my <%= link_to %>''s use example.com as the base url instead of mywebsite.myhost.com??? -- Posted via http://www.ruby-forum.com/.
I tried setting the default_url_options in my config/environments.rb like this: config.action_controller.default_url_options = { :host => ''example.com''} but I get this error when i restart my server I get this error, is there another way to accomplish this taks? /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:530:in `send'': undefined method `default_url_options='' for ActionController::Base:Class (NoMethodError) from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:530:in `initialize_framework_settings'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:529:in `each'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:529:in `initialize_framework_settings'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:526:in `each'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:526:in `initialize_framework_settings'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:154:in `process'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `send'' from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in `run'' ... 27 levels... from /opt/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/server.rb:49 from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'' from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'' from script/server:3 Ruby 1.8.6 Rails 2.2.2 -- Posted via http://www.ruby-forum.com/.
Still haven''t been able to figure this out. Instead i just changed the nameserver on go-daddy to point at my RoR host''s servers. So even though i can''t host the DNS on the same server, i can have the DNS point at my RoR host server. Learn something new every day! -- Posted via http://www.ruby-forum.com/.