problem with controllers

Hi all,

I have setup a ROR environment on my server and once i generate a controller with a few actions in it and put a basic message in each action within the controller rb file also editing the views for these actions all i get is the standard 404 not found. I can not understand why this is.

Any ideas

Thanks

Hi all,

I have setup a ROR environment on my server and once i generate a controller with a few actions in it and put a basic message in each action within the controller rb file also editing the views for these actions all i get is the standard 404 not found. I can not understand why this is.

Any ideas

Have you edited your routes.rb file to reflect this new controller? The default since quite a while now has been for there to *not* be a "catch-all" route that would attempt to handle anything that didn't have an explicit declaration. You may need to add a line like this:

resources :modelname

if you have all of the basic 7 REST routes covered, or another route that more explicitly lays out the controller methods you want to expose.

Walter

I am use REE too if thats helps, as when starting webrick i get can't connect to mysql so its bit more than the other with is on like i said REE and apache 2.

Thanks

Post the full error message. We are not telepathic. At least I am not. Copy and paste it, do not retype it.

Also are you able to access the database from mysql command line or GUI?

Also tell us which operating system you are using and which version of Rails.

Colin

Sorry i didn't load the passenger module it wooops, but now i'm getting a message:

We're sorry, but something went wrong.

Look in log/development.log or/and in the server terminal window, there should be more info there.

Colin

Hi colin,

Theres no log/development.log ? and i can't find the log anywhere, i even tried the apache log but nothing in there either :frowning:

Thanks

Its works fine with webrick but not passenger/apache

Right i have changed the permission off the whole app folder to apache:apache and the message has gone but has not render the html.erb file :S

here is the passenger log and the error is shown as access front/home:

[ pid=2235 thr=140125444347872 file=ext/apache2/Hooks.cpp:1378 time=2012-04-07 21:48:23.774 ]: Initializing Phusion Passenger... [ pid=2235 thr=140125444347872 file=ext/apache2/Hooks.cpp:1653 time=2012-04-07 21:48:23.822 ]: Shutting down Phusion Passenger... [ pid=2244 thr=139682403870688 file=ext/common/LoggingAgent/Main.cpp:283 time=2012-04-07 21:48:23.822 ]: Logging agent online, listening at unix:/tmp/passenger.1.0.2235/generation-0/logging.socket [ pid=2253 thr=140125444347872 file=ext/apache2/Hooks.cpp:1378 time=2012-04-07 21:48:23.879 ]: Initializing Phusion Passenger... [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/Main.cpp:283 time=2012-04-07 21:48:23.931 ]: Logging agent online, listening at unix:/tmp/passenger.1.0.2253/generation-0/logging.socket [ pid=2252 thr=140230241036064 file=ext/common/Watchdog.cpp:925 time=2012-04-07 21:48:31.38 ]: All Phusion Passenger agent processes have exited. [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:48:38.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:48:53.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:49:08.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:49:23.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:49:38.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:49:53.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:50:08.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:50:23.926 ]: Flushing all sinks (periodic action) [ pid=2258 thr=140485319882496 file=ext/common/ApplicationPool/Pool.h:939 time=2012-04-07 21:50:34.694 ]: Spawning a process for /home/domains/22level/lan/railsapp/sys because there are none for this app group [ pid=2258 thr=140485319882496 file=ext/common/ApplicationPool/../SpawnManager.h:289 time=2012-04-07 21:50:34.694 ]: Spawning a new application process for /home/domains/22level/lan/railsapp/sys... [ pid=2258 thr=140485319882496 file=ext/common/ApplicationPool/../SpawnManager.h:410 time=2012-04-07 21:50:36.317 ]: Application process 2295 spawned [ pid=2258 thr=140485319882496 file=ext/common/Process.h:116 time=2012-04-07 21:50:36.317 ]: Application process 2295 (0x7fc538002a80): created. [ pid=2270 thr=140125444347872 file=ext/apache2/Hooks.cpp:666 time=2012-04-07 21:50:36.318 ]: Forwarding /front/home to PID 2295 [ pid=2295 thr=11469100 file=abstract_request_handler.rb:244 time=2012-04-07 21:50:36.523 ]: Entering request handler main loop [ pid=2295 thr=11469100 file=abstract_request_handler.rb:466 time=2012-04-07 21:50:36.524 ]: Accepting new request on main socket [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:50:38.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:50:53.926 ]: Flushing all sinks (periodic action) [ pid=2292 thr=140125444347872 file=ext/apache2/Hooks.cpp:666 time=2012-04-07 21:51:04.611 ]: Forwarding /front/home to PID 2295 [ pid=2295 thr=11469100 file=abstract_request_handler.rb:466 time=2012-04-07 21:51:04.611 ]: Accepting new request on main socket [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:51:08.926 ]: Flushing all sinks (periodic action) [ pid=2270 thr=140125444347872 file=ext/apache2/Hooks.cpp:666 time=2012-04-07 21:51:18.417 ]: Forwarding /front/home to PID 2295 [ pid=2295 thr=11469100 file=abstract_request_handler.rb:466 time=2012-04-07 21:51:18.417 ]: Accepting new request on main socket [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:51:23.926 ]: Flushing all sinks (periodic action) [ pid=2292 thr=140125444347872 file=ext/apache2/Hooks.cpp:666 time=2012-04-07 21:51:27.702 ]: Forwarding /front/home to PID 2295 [ pid=2295 thr=11469100 file=abstract_request_handler.rb:466 time=2012-04-07 21:51:27.703 ]: Accepting new request on main socket [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:51:38.926 ]: Flushing all sinks (periodic action) [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:51:53.926 ]: Flushing all sinks (periodic action) [ pid=2270 thr=140125444347872 file=ext/apache2/Hooks.cpp:666 time=2012-04-07 21:51:55.364 ]: Forwarding /front/home to PID 2295 [ pid=2295 thr=11469100 file=abstract_request_handler.rb:466 time=2012-04-07 21:51:55.364 ]: Accepting new request on main socket [ pid=2263 thr=140119827085280 file=ext/common/LoggingAgent/LoggingServer.h:829 time=2012-04-07 21:52:08.926 ]: Flushing all sinks (periodic action)

Thanks

The apache access log says :

[07/Apr/2012:22:04:38 +0400] "GET /front/home HTTP/1.1" 500 643 ; when the message show

[07/Apr/2012:22:04:38 +0400] "GET /front/home HTTP/1.1" 500 - ; when the message don't show due to changing the permission.

OK problem has been fixed by setting RailsEnv to development and it works, but setting it to production message comes back so it looks like passenger run it default in production mode so i don't know why this is.

passenger _always_ runs in production mode if not specified else

<VirtualHost *> ServerName example.com DocumentRoot /app/public RailsEnv development </VirtualHost>

tom

Oh ok, so are there other option need to be set for the production env to stop the "We're sorry, but something went wrong." message

Oh ok, so are there other option need to be set for the production env to stop the "We're sorry, but something went wrong." message

"We're sorry, but something went wrong." message says there's something wrong in your code/setup. You have to check your log in log/ directory (either production/development.log)

tom

how comes it works in the development as its the same app?

Look in production.log and you may find out. There is no way anyone here can know the answer. There are innumerable possibilities from forgetting to create the production database to subtle page caching problems.

Colin

I have sorted it, it was due to the application.css not being compiled

Thanks for your help