New Rails app is not working... I am missing something

Hi,
So I have two rails applications working on my box. Theya re both
tutorials that I walked through step by step.

Now I am trying to write my own application and something is not
working.

My server is OS X 10.3.x. I am using Apache 1.3.x as the webserver with
fcgi.

As I mentioned before all is well with the apps that I had walk through
tutorials with, but my app is not working.

I think the issue lies with Apache. – OK Here we go

I was able to create my rails app (rails asset_track)
I was able to set up my website to point the public directory of my app,
and I get the “Welcome Aboard” page at http://example.com/asset/
I was able to create a controller (ruby script/generate scaffold Asset
Admin)
but when I go to www.example.com/asset/admin I get the following

Not Found
The requested URL /asset/admin was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use
an ErrorDocument to handle the request.
Apache/1.3.33 Server at www.example.com Port 80

What am I missing?

I have copied the settings for the virtual server in httpd.conf
I have also copied the settings in …/public/.htaccess

Any ideas?

Can you run this Rails application with Webrick? Then you will know
for sure it is Apache.

Peter

Peter M. wrote:

Can you run this Rails application with Webrick? Then you will know
for sure it is Apache.

Peter

How do I do this?

How do I do this?

Super easy to start webrick.

To create a new app and run it with webrick

$ rails new_app
$ cd new_app
$ script/server

Then navigate to localhost:3000 to see the Rails welcome page

after that works, try it for your_app

$ cd your_app
$ script/server

Then navigate to localhost:3000 and then navigate to
localhost:3000/asset/admin

I was surprised you are using apache when webrick is so easy to use
for development.

Peter

Well…

Starting Webrick was easy… I got the following message when went to
http://www.example.com/asset/admin/

Application error

Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html

I am really uncertain what is not working here.

From development.log

Recognition failed for “/asset/admin”
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:488:in
recognition_failed' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:478:inrecognize!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:inhandle_dispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/local/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:89:ineach’
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in start' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire__’
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
script/server:3

This file is on the server

asset_track/app/controllers/admin_controller.rb

What is going on here… It seems to think that the file is missing…
But it is there.

nitefall wrote:

Starting Webrick was easy… I got the following message when went to
http://www.example.com/asset/admin/

Application error

Do you have a file app/controller/admin_controller.rb?

Ray

Perhaps with Apache there is something wrong with mod_rewirte… but
the above log entries are all to do with webrick.

I have no idea where to go from here.

Ray B. wrote:

nitefall wrote:

Starting Webrick was easy… I got the following message when went
to http://www.example.com/asset/admin/

Application error

Do you have a file app/controller/admin_controller.rb?

I should have written, “Do you have a file
app/controller/asset_controller.rb?”

If you do, does that file have a method admin?

Ray

Ray B. wrote:

I should have written, “Do you have a file
app/controller/asset_controller.rb?”

If you do, does that file have a method admin?

Ray

Negative… I do not have a file called asset_controller.rb Perhaps
because I have not tried to create a scaffold for it yet??

Should I create one?

nitefall wrote:

Ray B. wrote:

I should have written, “Do you have a file
app/controller/asset_controller.rb?”

If you do, does that file have a method admin?

Negative… I do not have a file called asset_controller.rb Perhaps
because I have not tried to create a scaffold for it yet??

Should I create one?

If you want to access the url http://www.example.com/asset/admin as you
were doing in an earlier post then need an asset controller that
contains an admin action.

In that same post you said that you had created an admin controller, so
perhaps you need to create an asset action in that controller and access
the url http://www.example.com/admin/asset.

Ray

Wait!

Looking back now I see that when using webrick I indeed went to
example.com:3000/asset/admin.

So I just tried it again, using webrick as the server, and the URL
www.example.com:3000/admin and I get hte same error.

Application error

Change this error message for exceptions thrown outside of an action
(like in Dispatcher setups or broken Ruby code) in public/500.html

Any ideas from here? What other info do you need?

Ray B. wrote:

If you want to access the url http://www.example.com/asset/admin as you
were doing in an earlier post then need an asset controller that
contains an admin action.

In that same post you said that you had created an admin controller, so
perhaps you need to create an asset action in that controller and access
the url http://www.example.com/admin/asset.

Ray

The path to the application is http://www.example.com/asset/

In other words… /asset is aliased (in apache) to the ./public
directory of the application.

When I used webbrick I used http://www.example.com:3000/admin

Admin is the controller, not asset.

Eitherway I get the issue of some files not being in the right place.

Charlie B. wrote:

What’s in your development_log?

Recognition failed for “/asset”
/usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:488:in
recognition_failed' /usr/local/lib/ruby/gems/1.8/gems/actionpack-1.12.1/lib/action_controller/routing.rb:478:inrecognize!’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/dispatcher.rb:38:in
dispatch' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:115:inhandle_dispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:81:in
service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:inservice’
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in run' /usr/local/lib/ruby/1.8/webrick/server.rb:155:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:144:instart_thread’
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:89:ineach’
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in start' /usr/local/lib/ruby/1.8/webrick/server.rb:79:instart’
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in start' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/webrick_server.rb:67:indispatch’
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/servers/webrick.rb:59
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require__' /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire’
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:in
require' /usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/commands/server.rb:30 /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:inrequire__’
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
require' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:147:inrequire’
script/server:3

whats in your config/routes.rb? It seems like rails doesn’t know how to
map your url.

What’s in your development_log?

Charlie B. wrote:

whats in your config/routes.rb? It seems like rails doesn’t know how to
map your url.


Here is my routes.rb file:

ActionController::Routing::Routes.draw do |map|

The priority is based upon order of creation: first created ->

highest priority.

Sample of regular route:

map.connect ‘products/:id’, :controller => ‘catalog’, :action =>

‘view’

Keep in mind you can assign values other than :controller and

:action

Sample of named route:

map.purchase ‘products/:id/purchase’, :controller => ‘catalog’,

:action => ‘purchase’

This route can be invoked with purchase_url(:id => product.id)

You can have the root of your site routed by hooking up ‘’

– just remember to delete public/index.html.

map.connect ‘’, :controller => “welcome”

Allow downloading Web Service WSDL as a file with an extension

instead of a file named ‘wsdl’

map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’

Install the default route as the lowest priority.

map.connect ‘:controller/:action/:id’
end

Really… I want to be using Apache…

What does the routes.rb file specify (routes clearly) Is it only for
webrick?? Or does it effect Apache as well??

What can I do to get Apache to recognize these files??

Is something incorrect with the rewrite module?

Help ?!?!?!

Dave R. wrote:

My email server is down, so by the time you get this, I’m sure you’ll
have
the answer. If not…

If you’re using webrick, the url will be /admin, not /asset/admin,
unless
you’ve put something in your routes.rb file to make recognize
/asset/admin.

Dave

OK

I deleted the application directory (/path/to/asset_track/)

Re-created it (rails asset_track)

set …/config/databse.yml correctly

Built the Admin Controller (ruby script/generate scaffold Asset Admin)

Started WebBrick and it seems to be working.

But it still is not working in Apache.

How can I get this working in Apache?