Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails paths leading to domain with "ude" instead of "localhost"

For some reason when I test, all my paths and link lead to a domain of "ude" rather than the usual localhost. Where should I start to dig to figure this out?

like image 545
stackjlei Avatar asked Mar 07 '17 17:03

stackjlei


3 Answers

Could you check your environments/test.rb, environments/development and make sure the following is set to the URL you want :

Rails.application.routes.default_url_options[:host] = 'DESIRED URL'
like image 165
Jeremie Avatar answered Oct 18 '22 23:10

Jeremie


You can change your domain name by using the following command in your terminal

sudo nano /etc/hosts

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
192.168.56.2   qruqsp.local









                               [ Read 10 lines ]
^G Get Help  ^O WriteOut  ^R Read File ^Y Prev Page ^K Cut Text  ^C Cur Pos
^X Exit      ^J Justify   ^W Where Is  ^V Next Page ^U UnCut Text^T To Spell

change 127.0.0.1 to localhost instead of ude in your case

Refresh DNS settings with sudo dscacheutil -flushcache

Now rails server will work now with http://localhost:3000/

Also you can change it to anything you like for example

add a line in 127.0.0.1 www.rubyrails.com

and refresh the DNS setting with sudo dscacheutil -flushcache

Now rails server will run in http://www.rubyrails.com:3000/

like image 4
supar Avatar answered Oct 19 '22 00:10

supar


Use the url helpers that end in _path (relative) instead of _url (absolute)

like image 1
engineerDave Avatar answered Oct 18 '22 23:10

engineerDave