Depending on how WEBrick in invoked I get different results. If I invoke
it like "expenses/script/server" and point the browser to <http://
localhost:3000/expenses> I''ll get:
Not Found
`/expenses'' not found.
WEBrick/1.3.1 (Ruby/1.8.6/2007-09-24) at localhost:3000
However, if I change to the expenses directory and start WEBrick with
"script/server" I get a different result of:
Routing Error
no route found to match "/expenses" with {:method=>:get}
1.) why the discrepancy?
2.) from a ruby script (start_webrick.rb perhaps), how would WEBrick be
invoked? Assuming that start_webrick.rb is outside of the "expenses"
directory created by rails.
Here''s output from WEBrick, if that''s at all useful:
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ expenses/script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-11-25 21:01:28] INFO WEBrick 1.3.1
[2007-11-25 21:01:28] INFO ruby 1.8.6 (2007-09-24) [i686-linux]
[2007-11-25 21:01:28] INFO WEBrick::HTTPServer#start: pid=9164 port=3000
#<ArgumentError: Anonymous modules have no name to be referenced by>
["/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/
dependencies.rb:404:in `to_constant_name''",
"/usr/lib/ruby/gems/1.8/gems/
activesupport-1.4.4/lib/active_support/dependencies.rb:214:in
`qualified_name_for''",
"/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/
lib/active_support/dependencies.rb:476:in `const_missing''",
"/usr/lib/
ruby/gems/1.8/gems/rails-1.2.5/lib/dispatcher.rb:116:in
`reset_after_dispatch''",
"/usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/
dispatcher.rb:50:in `dispatch''",
"/usr/lib/ruby/gems/1.8/gems/rails-1.2.5/
lib/webrick_server.rb:113:in `handle_dispatch''",
"/usr/lib/ruby/gems/1.8/
gems/rails-1.2.5/lib/webrick_server.rb:79:in `service''",
"/usr/lib/
ruby/1.8/webrick/httpserver.rb:104:in `service''",
"/usr/lib/ruby/1.8/
webrick/httpserver.rb:65:in `run''",
"/usr/lib/ruby/1.8/webrick/
server.rb:173:in `start_thread''", "/usr/lib/ruby/1.8/webrick/
server.rb:162:in `start''",
"/usr/lib/ruby/1.8/webrick/server.rb:162:in
`start_thread''", "/usr/lib/ruby/1.8/webrick/server.rb:95:in
`start''", "/
usr/lib/ruby/1.8/webrick/server.rb:92:in `each''",
"/usr/lib/ruby/1.8/
webrick/server.rb:92:in `start''", "/usr/lib/ruby/1.8/webrick/
server.rb:23:in `start''",
"/usr/lib/ruby/1.8/webrick/server.rb:82:in
`start''", "/usr/lib/ruby/gems/1.8/gems/rails-1.2.5/lib/
webrick_server.rb:63:in `dispatch''",
"/usr/lib/ruby/gems/1.8/gems/
rails-1.2.5/lib/commands/servers/webrick.rb:59", "/usr/lib/ruby/
site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require''", "/
usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require''", "/
usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/
dependencies.rb:495:in `require''",
"/usr/lib/ruby/gems/1.8/gems/
activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
`new_constants_in''",
"/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/
active_support/dependencies.rb:495:in `require''",
"/usr/lib/ruby/gems/1.8/
gems/rails-1.2.5/lib/commands/server.rb:39",
"/usr/lib/ruby/site_ruby/1.8/
rubygems/custom_require.rb:27:in `gem_original_require''",
"/usr/lib/ruby/
site_ruby/1.8/rubygems/custom_require.rb:27:in `require''",
"expenses/
script/server:3"]
[2007-11-25 21:01:36] ERROR `/expenses'' not found.
127.0.0.1 - - [25/Nov/2007:21:01:36 PST] "GET /expenses HTTP/1.1" 404
278
http://developer.apple.com/tools/rubyonrails.html -> /expenses
[2007-11-25 21:01:46] INFO going to shutdown ...
[2007-11-25 21:01:46] INFO WEBrick::HTTPServer#start done.
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $
thufir@arrakis ~/rubyCode $ cd expenses/
thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $ script/server
=> Booting WEBrick...
=> Rails application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2007-11-25 21:02:05] INFO WEBrick 1.3.1
[2007-11-25 21:02:05] INFO ruby 1.8.6 (2007-09-24) [i686-linux]
[2007-11-25 21:02:05] INFO WEBrick::HTTPServer#start: pid=9167 port=3000
127.0.0.1 - - [25/Nov/2007:21:02:11 PST] "GET /expenses HTTP/1.1" 404
622
http://developer.apple.com/tools/rubyonrails.html -> /expenses
[2007-11-25 21:02:25] INFO going to shutdown ...
[2007-11-25 21:02:25] INFO WEBrick::HTTPServer#start done.
thufir@arrakis ~/rubyCode/expenses $
thufir@arrakis ~/rubyCode/expenses $
thanks,
Thufir
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---