Ruby on rails 使用模型中的路由帮助程序时不尊重RackEnv
Apache乘客运行轨道3.2.13。我的虚拟主机:Ruby on rails 使用模型中的路由帮助程序时不尊重RackEnv,ruby-on-rails,apache,passenger,rack,Ruby On Rails,Apache,Passenger,Rack,Apache乘客运行轨道3.2.13。我的虚拟主机: <VirtualHost *:80> ServerName server DocumentRoot /srv/http <Directory /> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> RackEnv
<VirtualHost *:80>
ServerName server
DocumentRoot /srv/http
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
RackEnv test
RackBaseURI /rails_app
<Directory /srv/http/rails_app>
Options -MultiViews
</Directory>
</VirtualHost>
在视图中呈现URL时,子URI的使用与我预期的一样,但是当从模型中访问URL帮助器时,它将被丢弃,并且路径始终相对于根
从控制器.rb:
edit_egg_path(1000) --> /rails_app/eggs/1000/edit
从某些_model.rb:
edit_egg_path(1000) --> /eggs/1000/edit
这应该像我期望的那样工作吗?我一点也不介意手动修复这个问题,但是我很难找到RackBaseURI的值,这样我就可以手动插入它(如果它存在的话)。我不希望在某些环境配置中再次手动定义它,因为Rails必须已经知道了。您解决了这个问题吗?我有一个类似的问题:我已经做了一个惊人的黑客围绕这一点(见我的问题)。我不这样认为。我知道这不是答案,但我已经开始使用Unicorn,只是从Apache代理,而不是使用Passenger。
edit_egg_path(1000) --> /eggs/1000/edit