Forum: Ruby on Rails New Rails app is not working... I am missing something

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-07 00:18
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?
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 Peter Michaux (Guest)
on 2006-05-07 06:12
(Received via mailing list)
Can you run this Rails application with Webrick? Then you will know
for sure it is Apache.

Peter
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-07 10:06
Peter Michaux wrote:
> Can you run this Rails application with Webrick? Then you will know
> for sure it is Apache.
>
> Peter

How do I do this?
Eea3feaacbe44706164289d068d94828?d=identicon&s=25 Peter Michaux (Guest)
on 2006-05-07 16:31
(Received via mailing list)
> 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
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-08 00:27
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.
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-08 00:40
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.
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-08 00:50
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:in
`recognize!'
/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:in
`handle_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:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'
/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:in
`dispatch'
/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:in
`require'
/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:in
`require__'
/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:in
`require'
script/server:3
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-08 00:53
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.
E28c35323f624b8b9ed8712e25105454?d=identicon&s=25 Ray Baxter (Guest)
on 2006-05-08 01:41
(Received via mailing list)
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
E28c35323f624b8b9ed8712e25105454?d=identicon&s=25 Ray Baxter (Guest)
on 2006-05-08 01:51
(Received via mailing list)
Ray Baxter 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
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-08 07:19
Ray Baxter 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?
E28c35323f624b8b9ed8712e25105454?d=identicon&s=25 Ray Baxter (Guest)
on 2006-05-08 20:36
(Received via mailing list)
nitefall wrote:
> Ray Baxter 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
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-09 16:04


Ray Baxter 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.
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-09 16:12
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?
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-05-09 16:17
(Received via mailing list)
What's in your development_log?
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-09 16:59
Charlie Bowman 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:in
`recognize!'
/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:in
`handle_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:in `service'
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/local/lib/ruby/1.8/webrick/server.rb:155:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:144:in `start_thread'
/usr/local/lib/ruby/1.8/webrick/server.rb:94:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `each'
/usr/local/lib/ruby/1.8/webrick/server.rb:89:in `start'
/usr/local/lib/ruby/1.8/webrick/server.rb:79:in `start'
/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:in
`dispatch'
/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:in
`require'
/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:in
`require__'
/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:in
`require'
script/server:3
89d967359903c639d31e4cad4569f537?d=identicon&s=25 Charlie Bowman (Guest)
on 2006-05-09 19:16
(Received via mailing list)
whats in your config/routes.rb? It seems like rails doesn't know how to
map your url.
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 nitefall (Guest)
on 2006-05-10 05:14
Charlie Bowman 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
615bdd4621a6d581d8e1abc854d8b5db?d=identicon&s=25 Dave Ringoen (Guest)
on 2006-05-10 20:14
(Received via mailing list)
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
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 Nitefall (Guest)
on 2006-05-13 00:26
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 Ringoen 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
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 Nitefall (Guest)
on 2006-05-13 09:02
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?
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 Nitefall (Guest)
on 2006-05-14 19:14
So here I have found the weak spot...   If it doesn't work under Apache,
then Rails becomes useless to me very quickly.

There is clearly some simple setting that needs to be changed, and I
don't know what it is... I have completely disassembled my httpd.conf
file, and the .htaccess file in the apps public directory.  It looks
fine to me, but then...

Something has this not working, and I don't know exactly what I need to
be looking for.



Nitefall wrote:
> 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?
30ee518e6fdc5b07e060775b5a542bdb?d=identicon&s=25 Jón Borgþórsson (jongretar)
on 2006-05-14 19:41
(Received via mailing list)
If it's not working in Apache but works in Webrick then clearly you
are having problem with rights. Check what user the apache server is
running on. It's propably apache or nobody. Then set the user of your
app to be that.

It could also be that your public/.htaccess is wrong. Make sure it
points to dispatch.fcgi instead of .cgi.

On 5/14/06, Nitefall <nitefall@comcast.net> wrote:
>
> >
> Posted via http://www.ruby-forum.com/.
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>


--
0b1dbcfd2b92a139b9143e4ea7bc58c7?d=identicon&s=25 Nitefall (Guest)
on 2006-05-14 21:31
Jón Borgþórsson wrote:
> If it's not working in Apache but works in Webrick then clearly you
> are having problem with rights. Check what user the apache server is
> running on. It's propably apache or nobody. Then set the user of your
> app to be that.
>
> It could also be that your public/.htaccess is wrong. Make sure it
> points to dispatch.fcgi instead of .cgi.
>

It was the permissions  :)

The thing I don't understand is this.

The files for the tutorial application I built with the help of a book
were owned by webmaster:www

I set the file ownership and permissions for my new app identically to
the tutorial's ownership and permissions.  Going through each directory
one at a time...  making sure all was the same.

My app didn't run.

But a simple chmod -R www:www ./myapp/  made my applicaiton work.

There must be a single thing that I missed in the tutorial app.

Well...  All is well now.

Thanks!!!
This topic is locked and can not be replied to.