Agile Rails book code fails page 32

Starting Agile Web D. with Rails, page 32, everything has
worked
well so far but on (book not pdf) page 32 I don’t get the “Template Is
Missing” error. I get

Routing Error

Cannot load config/routes.rb:
No such file to load – ./demo/script/…/config/…/config/routes.rb

There is a file at e:\ruby\ror\work\demo\config\routes.rb

It’s all greek to me and of course the book assumes that it all works.
Any
help appreciated. I’ve tried many different paths besides the suggested
http://localhost:3000/say/hello and nothing works better. Creating the
rhtml
file in views doesn’t change anything.

View this message in context:
http://www.nabble.com/Agile-Rails-book-code-fails-page-32-t1184638.html#a3119687
Sent from the RubyOnRails Users forum at Nabble.com.

Strange stuff … didn’t fail for me there. Try deleting the whole app
and
starting fresh. Could be a fluke occurence …

Greg

On 2/24/06, Michael B. [email protected] wrote:

Sent from the RubyOnRails Users forum at Nabble.com.


Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails


Greg MacGregor
Web D.
416-516-0395
www.sixminutes.ca

On Fri, 2006-02-24 at 19:49 -0800, Michael B. wrote:

It’s all greek to me and of course the book assumes that it all works. Any
help appreciated. I’ve tried many different paths besides the suggested
http://localhost:3000/say/hello and nothing works better. Creating the rhtml
file in views doesn’t change anything.


Craig

I del’d the demo hive and rebuilt it. I recieve this error now (I did
too
before attempting to adjust, adjusting produced the original error I
posted)

Routing Error

No route for path: “say/hello”

Failure reasons:
<ActionController::Routing::Route “:controller/service.wsdl” when
{:action=>“wsdl”}> failed because no controller found at subpath
say/hello
<ActionController::Routing::Route “:controller/:action/:id” ||
{:id=>nil,
:action=>“index”}> failed because no controller found at subpath
say/hello

This is perhaps a more clueful error msg. It’s still not the err
expected
per the book. The file “say_controller.rb” does exist in controllers and
it
has the

def hello
end

which the book asks for. I’m on windows, maybe that makes the server
behave
a bit differently?

View this message in context:
http://www.nabble.com/Agile-Rails-book-code-fails-page-32-t1184638.html#a3120544
Sent from the RubyOnRails Users forum at Nabble.com.

On Fri, 2006-02-24 at 22:40 -0800, Michael B. wrote:

Yes I checked the errata before posting and couldn’t find any ref to this.


I was referring you to the note that apparently references p57

#2295: The ‘gotcha’ notes (3,4,& 5) are useful. You might consider
adding another…

If you get Routing Error: Recognition failed for ‘/admin’, make sure
that you’re starting WEBrick from the depot folder and not the demo
folder.–Jason

But if I recall myself (and it’s been a few weeks…I didn’t get that
same error message either and just pushed on)

Craig

Yes I checked the errata before posting and couldn’t find any ref to
this.

View this message in context:
http://www.nabble.com/Agile-Rails-book-code-fails-page-32-t1184638.html#a3120525
Sent from the RubyOnRails Users forum at Nabble.com.

Thanks Craig

Yes I stopped webbrick. But no I had just repeated the prev path…I’d
started from the work dir and use command

ruby demo/script/server

Moving to the demo dir and using

ruby script/server

made it work as expected. Thanks for the pointer. On the next page when
creating the Say controller they mention that one should be in the demo
dir.

View this message in context:
http://www.nabble.com/Agile-Rails-book-code-fails-page-32-t1184638.html#a3120688
Sent from the RubyOnRails Users forum at Nabble.com.

On Fri, 2006-02-24 at 22:45 -0800, Michael B. wrote:

<ActionController::Routing::Route “:controller/:action/:id” || {:id=>nil,
a bit differently?


maybe - but not for this.

Did you stop webrick and cd to the correct directory and start webrick
again…you need to do that - you must run webrick from the proper
location for it to ‘route’ correctly.

Craig

To settle this in my head a bit, the reason the server must be started
in the
project folder is because webbrick is acting as a simple dev server;
thus
the shortened urls to execute the scripts?

View this message in context:
http://www.nabble.com/Agile-Rails-book-code-fails-page-32-t1184638.html#a3124902
Sent from the RubyOnRails Users forum at Nabble.com.

On Sat, 2006-02-25 at 08:59 -0800, Michael B. wrote:

To settle this in my head a bit, the reason the server must be started in the
project folder is because webbrick is acting as a simple dev server; thus
the shortened urls to execute the scripts?


No the reason is that the routes all stem from the base directory (which
in reality is path_to_rails_app/public and thus the
path …/app/controller is the cgi path) so if you run the script/server
that is the proper one for your application, you don’t need to fix any
routes (paths to the files for your webserver, in this case
script/server is your web server).

The end result of default routes wouldn’t change if you were to use say
Apache or lighttpd or Mongrel or whatever as your web server. Nor should
they change if you go from development to production environment.

Craig

On 2/25/06, Craig W. [email protected] wrote:

No the reason is that the routes all stem from the base directory (which
in reality is path_to_rails_app/public and thus the
path …/app/controller is the cgi path) so if you run the script/server
that is the proper one for your application, you don’t need to fix any
routes (paths to the files for your webserver, in this case
script/server is your web server).

I wish there were a way to change that. Having to start all my
development servers from WITHIN the path_to_rails_app directory means
that all my servers show up in ‘ps’ as “ruby script/server -p
someport” so I need to fire up a web browser to match ports to servers
instead of being able to restart the server I want by looking at the
output of ps.

Cynthia K.
[email protected]

I’m working through the book ‘Agile web development with rails’ and have
come upon the Routing error issue in the code on page 57. I’ve googled
this and found a lot of reference to starting the server from the
correct directory… which I am doing, but I’m still not seeing
anything. Seems like scaffold has ignored the Admin parameter as I don’t
have admin_controller.rb in my apps/controllers directory. Here’s the
output of my ruby script/generate scaffold Product Admin:

./script/…/config/…/config/environment.rb:8: warning: already
initialized constant RAILS_GEM_VERSION
exists app/controllers/
exists app/helpers/
create app/views/admin
exists test/functional/
dependency model
exists app/models/
exists test/unit/
exists test/fixtures/
create app/models/product.rb
create test/unit/product_test.rb
create test/fixtures/products.yml
No such file or directory - /tmp/mysql.sock

Any ideas? Should I go back to previous versions of Ruby and Rails, I’m
currently on latest of both.

Many thanks
Kevin

On Wed, 2006-04-12 at 02:00 +0200, Kevin Price-Ward wrote:

  exists  app/controllers/

No such file or directory - /tmp/mysql.sock

Any ideas? Should I go back to previous versions of Ruby and Rails, I’m
currently on latest of both.


you should be ok - check out the errata page for your version of the
book…

Craig

Kevin Price-Ward wrote:

Hmmm,

The only note on the errata link for page 57 says ‘make sure you start
webrick from the right folder’ - I’m in the depot directory when I run
‘ruby script/server’ - so I think that’s OK.

It also says: “#2295: The ‘gotcha’ notes (3,4,& 5) are useful.” - what
are the gotcha notes (I’m probably being really thick, so please forgive
me if it’s completely obvious).

Regards
Kevin

Could it be that my mySQL version is old? I’m still on version 3.23.58 -
probably not, but it’s just a thought!

Regards
Kevin

Hmmm,

The only note on the errata link for page 57 says ‘make sure you start
webrick from the right folder’ - I’m in the depot directory when I run
‘ruby script/server’ - so I think that’s OK.

It also says: “#2295: The ‘gotcha’ notes (3,4,& 5) are useful.” - what
are the gotcha notes (I’m probably being really thick, so please forgive
me if it’s completely obvious).

Regards
Kevin

On Sat, 2006-02-25 at 17:14 -0800, Cynthia K. wrote:

that all my servers show up in ‘ps’ as “ruby script/server -p
someport” so I need to fire up a web browser to match ports to servers
instead of being able to restart the server I want by looking at the
output of ps.


well - that’s more like a user issue

if you start it with full path, you will know which one it is from ps…

ruby script/server -e development -p 8000

or

ruby /home/craig/ruby-db/th-db/script/server -e development -p 8100

will give entirely different results in…

ps aux|grep script

Craig

I had the same error message few days ago
check in database.yml if the path for mysql.sock is ok
I can not be more precis because I don’t have RoR installed on my
computer at work ( for the moment :wink: )

On Sat, 2006-04-15 at 16:14 +0200, Kevin Price-Ward wrote:

Updating Gem source index for: http://gems.rubyforge.org
–without-opt-include=${opt-dir}/include
–without-mysql-dir
–with-zlib
–without-mysqlclientlib
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no

Results logged to
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Anyone got any ideas what’s going on here?


Looks like you don’t have the necessary mysql client packages installed.
On a Red Hat/Fedora system, you would want to install the mysql package
and the mysql-devel package (and the server package if the system was
also the mysql server).

Craig

Craig W. wrote:

Attempting remote installation of ‘mysql’
–with-opt-include
–with-mysql-dir
–without-mysqlclientlib
–with-mysqlclientlib
checking for mysql_query() in -lmysqlclient… no


I just had the same 2 days ago. Make sure you have make installed (i did
not - i am running on ubuntu, and here e.g. you have to apt-get install
build-essential to have even make). Check also gcc. If this still does
not help (but i think it will), check the versions of mysql-client,
mysql-server etc.
Let me know if it works!

HTH,

Peter

Hi,

I checked database.yml, couldn’t see any reference to mysql.sock but it
did say to run this installation: gem install mysql - here’s the output
when I tryed:

[root@ns config]# gem install mysql
Attempting local installation of ‘mysql’
Local gem file not found: mysql*.gem
Attempting remote installation of ‘mysql’
Updating Gem source index for: http://gems.rubyforge.org
Building native extensions. This could take a while…
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/local/bin/ruby
–with-mysql-config
–without-mysql-config
–with-mysql-dir
–without-mysql-dir
–with-mysql-include
–without-mysql-include=${mysql-dir}/include
–with-mysql-lib
–without-mysql-lib=${mysql-dir}/lib
–with-mysqlclientlib
–without-mysqlclientlib
–with-mlib
–without-mlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-zlib
–without-zlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-socketlib
–without-socketlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-nsllib
–without-nsllib
–with-mysqlclientlib
–without-mysqlclientlib
ERROR: While executing gem … (RuntimeError)
ERROR: Failed to build gem native extension.
Gem files will remain installed in
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
ruby extconf.rb install mysql\nchecking for mysql_query() in
-lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… no

Results logged to
/usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out

Anyone got any ideas what’s going on here?

Kind regards
Kevin