0

My folders have the following structure: root is /home3/username

My web app is under rails_apps/my_app/ so my views are under 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 [~]# 

This is my rails_apps/my_app/config/routes.rb file

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

With this, my web application displays the content of file rails_apps/my_app/app/views/home/index.html.erb correctly, but when I click on the button "Manage Projects" it generates this error

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

I believe this is a routing issue, because I have another web app that is very similar to this one, except that it is directly under root and this one is under rails_apps folder, but I don't seem to be able to fix it.

Can someone please help?

rh4games
  • 962
  • 2
  • 15
  • 38
  • Thanks Adam. What config do you want me to post? – rh4games Sep 18 '12 at 06:08
  • Can you post the apache configuration for this site? – Adam Eberlin Sep 18 '12 at 06:12
  • Hi Adam, I'm trying to migrate my app, that's running fine on my Mac, into a linux server that's hosted by a commercial hosting provider ; I do not have access to their Apache config, but their support, after helping me to fix many other issues, said this is now a routing issue that must solved on my side. – rh4games Sep 18 '12 at 06:30
  • I would get access to production log files and see what specific error you are getting. If you can post the exact error, it would be pretty simple to get some answers. Just my 2c. – iouri Sep 18 '12 at 06:42
  • Hi iouri, here are he logs I'm seeing "[Tue Sep 18 00:55:35 2012] [error] [client ] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace." – rh4games Sep 18 '12 at 06:59

1 Answers1

0

I think that your form to takes you to the create action of the projects controller, since by default a form is going to issue a post request.

You might want to try something like this that will tell the form to issue a get request, which should take you to the index action.

<%= form_tag projects_path, :method => :get do %>
  <%= submit_tag "Manage projects" %>
<% end %>

But if I were you, I'd probably just use a link and style it to look like a button using css.

Cyrus
  • 3,687
  • 5
  • 35
  • 67
  • Thanks Cyrus for your prompt answer. I have the exact same app running fine in another environment (Mac) and the form starts like this <%= form_for(@project, :html => {:name => "ProjectInfo"}) do |f| %> <%= end %> I'm trying to implement the same application under linux, but I'm getting this issue. – rh4games Sep 18 '12 at 06:06
  • 1
    I agree with Cyrus.I think the problem is not OS specific. Could you please tell me the action name which displays the form <%= form_for(@project, :html => {:name => "ProjectInfo"}) do |f| %> ? – Soundar Rathinasamy Sep 18 '12 at 08:52
  • Thanks @sounder. For the homepage,I see these logs on log/development.log "Started GET "/" for at Tue Sep 18 07:59:34 -0600 2012 Processing by HomeController#index as HTML Rendered home/index.html.erb within layouts/application (0.1ms) Completed 200 OK in 11ms (Views: 10.1ms | ActiveRecord: 0.0ms)" but when I click "Manage Projects" button, I get that "Internal Server Error" message but I don't see any logs on the server – rh4games Sep 18 '12 at 14:07