由于某种原因,当我测试时,我的所有路径和链接都会导致"ude“域,而不是通常的本地主机。我应该从哪里开始挖掘才能弄明白这一点?
发布于 2017-03-11 00:48:56
您能否检查您的环境/test.rb,是否环境/开发,并确保以下设置为您想要的URL:
Rails.application.routes.default_url_options[:host] = 'DESIRED URL'发布于 2017-03-07 18:00:18
您可以在终端中使用以下命令更改域名
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将127.0.0.1改为本地主机,而不是在您的情况下更改ude
用sudo dscacheutil -flushcache刷新DNS设置
现在rails server将与http://localhost:3000/一起工作
此外,您也可以将其更改为任何您喜欢的东西,例如
在127.0.0.1 www.rubyrails.com中添加一行
并使用sudo dscacheutil -flushcache刷新DNS设置。
现在rails server将在http://www.rubyrails.com:3000/中运行
发布于 2017-03-13 19:57:01
使用以_path (相对)结尾的url帮助程序,而不是_url (绝对)
https://stackoverflow.com/questions/42654441
复制相似问题