Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 更改rails 4中域约束路由中的主机_Ruby On Rails_Ruby_Ruby On Rails 4_Routing - Fatal编程技术网

Ruby on rails 更改rails 4中域约束路由中的主机

Ruby on rails 更改rails 4中域约束路由中的主机,ruby-on-rails,ruby,ruby-on-rails-4,routing,Ruby On Rails,Ruby,Ruby On Rails 4,Routing,我的应用程序的主域类似于mysiteiscool.com 我有一个简短的url,比如myste.com,它指向该应用程序,并为其配置文件路径提供自己的特殊控制器 因此,在我的routes.rb文件中,我有如下内容: constraints DomainConstraint.new('myste.com') do get '/:short_name', to: 'short_name#index', as: 'short_root' end 这里的问题是,每次点击呈现页面之后,都会继续使用

我的应用程序的主域类似于mysiteiscool.com

我有一个简短的url,比如myste.com,它指向该应用程序,并为其配置文件路径提供自己的特殊控制器

因此,在我的routes.rb文件中,我有如下内容:

constraints DomainConstraint.new('myste.com') do
   get '/:short_name', to: 'short_name#index', as: 'short_root'
end
这里的问题是,每次点击呈现页面之后,都会继续使用myste.com主机名

在路由或控制器中,是否有办法将主机设置回mysiteiscool.com


也许在控制器渲染它的已找到对象之前?

这个问题似乎已经为我解答了

我没有像上面那样指向路由,而是简单地重定向到完整路径