我的文件夹具有以下结构: root是/ home3 / username
我的网络应用程序位于rails_apps / my_app /下,因此我的观看次数位于rails_apps / my_app / app / views
下username@company.com [~]# ls -la rails_apps/my_app/app/views/
total 24
drwxr-xr-x 6 username username 4096 Sep 17 00:48 ./
drwxr-xr-x 8 username username 4096 Sep 13 23:13 ../
drwxr-xr-x 2 username username 4096 Sep 17 01:51 home/
drwxr-xr-x 2 username username 4096 Sep 15 08:47 layouts/
drwxr-xr-x 2 username username 4096 Sep 17 00:00 projects/
drwxr-xr-x 2 username username 4096 Sep 17 00:49 scenarios/
username@company.com [~]# ls -la rails_apps/my_app/app/views/home/
total 16
drwxr-xr-x 2 username username 4096 Sep 17 01:51 ./
drwxr-xr-x 6 username username 4096 Sep 17 00:48 ../
-rw-r--r-- 1 username username 311 Sep 17 00:14 index.html.erb
username@company.com [~]#
username@company.com [~]# cat rails_apps/my_app/app/views/home/index.html.erb
<center><h1>my_app</h1></center>
<html>
<head>
</head>
<body>
<form action = "/projects">
<br>
<input type="submit" value="Manage Projects" />
</form>
<form action = "/scenarios">
<br>
<input type="submit" value="Manage Scenarios" />
</form>
</body>
</html>
username@company.com [~]#
这是我的rails_apps / my_app / config / routes.rb文件
My_app::Application.routes.draw do
resources :scenarios
resources :projects do
collection do
get :update_fields
get :annual_production
end
end
get "home/index"
match ':controller(/:action(/:id(.:format)))'
root :to => 'home#index'
end
有了这个,我的Web应用程序正确显示文件rails_apps / my_app / app / views / home / index.html.erb的内容,但当我点击按钮&#34;管理项目&#34;它会生成此错误
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@my_app.company.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Apache Server at my_app.company.com Port 80
我认为这是一个路由问题,因为我有另一个与这个非常类似的网络应用程序,除了它直接在root下,这个在rails_apps文件夹下,但我似乎不是能够解决它。
有人可以帮忙吗?
答案 0 :(得分:0)
我认为您的表单会将您带到项目控制器的创建操作,因为默认情况下表单将发出一个帖子请求。
你可能想尝试这样的事情来告诉表单发出一个get请求,这会引导你进行索引操作。
<%= form_tag projects_path, :method => :get do %>
<%= submit_tag "Manage projects" %>
<% end %>
但如果我是你,我可能只是使用一个链接,并使用css将其设置为按钮。