I followed these exact steps, and didn't get the stated behavior.
Everything worked
fine here (Rails 2.2.2, OS X 10.5).
If anybody's going to be able to solve your problem, they'll need more
information:
- versions, versions, versions. Which Rails? Which Netbeans? Which
operating system?
- "not working" (even in all caps) isn't a problem description. Does
it throw an exception?
What appears in development.log when the code is "not working"?
Product Version: NetBeans IDE 6.5 (Build 200811100001)
Java: 1.5.0_16; Java HotSpot(TM) Client VM 1.5.0_16-132
System: Mac OS X version 10.4.11 running on ppc; MacRoman; it_IT (nb)
Jruby 1.1.4
Rails 2.1.0
Not working means when you click on "create" you just get rediret to
/animals but witout the creation of the animal
(the green message "Animal was successfully created." ) dont show up
in the developmet.log there is
-------------------------------WHEN NOT WORKING------------------------
Processing AnimalsController#new (for 0:0:0:0:0:0:0:1%0 at 2009-03-04
23:09:53) [GET]
Session ID:
BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
SGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlOGI1MjEyYWE4MGE5Y2M4NWRi
YjAxZDdhMjljNmNhY2Q=--71ff32314b47ece66cddbf1b8b4b0a88a7c0e034
Parameters: {"controller"=>"animals", "action"=>"new"}
e[4;36;1mAnimal Columns (0.009045)e[0m e[0;1mSHOW FIELDS FROM
`animals`e[0m
Rendering template within layouts/animals
Rendering animals/new
Completed in 0.08431 (11 reqs/sec) | Rendering: 0.03623 (42%) | DB:
0.00904 (10%) | 200 OK [http://localhost/animals/new\]
Processing AnimalsController#index (for 0:0:0:0:0:0:0:1%0 at 2009-03-04
23:10:01) [POST]
Session ID:
BAh7ByIKZmxhc2hJQzonQWN0aW9uQ29udHJvbGxlcjo6Rmxhc2g6OkZsYXNo
SGFzaHsABjoKQHVzZWR7ADoMY3NyZl9pZCIlOGI1MjEyYWE4MGE5Y2M4NWRi
YjAxZDdhMjljNmNhY2Q=--71ff32314b47ece66cddbf1b8b4b0a88a7c0e034
Parameters:
{"authenticity_token"=>"6bcbdc49394efcb0a75d6e3c4f42ca1413119046",
"animal"=>{"name"=>"prova", "speed"=>"45"}, "commit"=>"Create",
"controller"=>"animals", "action"=>"index"}
e[4;35;1mAnimal Load (0.003691)e[0m e[0mSELECT * FROM `animals` e[0m
Rendering template within layouts/animals
Rendering animals/index
e[4;36;1mAnimal Columns (0.012850)e[0m e[0;1mSHOW FIELDS FROM
`animals`e[0m
Completed in 0.10228 (9 reqs/sec) | Rendering: 0.05008 (48%) | DB:
0.01654 (16%) | 200 OK [http://localhost/animals\]
I agree with this - the problem you ran into was that the routes file
didn't get reloaded correctly. This is a known issue (see
http://rails.lighthouseapp.com/projects/8994/tickets/981-fix-for-routing-optimization-code
) with the 2.1 series. I would *highly* recommend that you upgrade to
2.2.2, or even wait a bit for 2.3 to drop. Apart from supporting
production sites, there's very little reason to stay with older
versions, and lots of reasons (read: fixed bugs) to move forward.