Forum: Ruby on Rails scaffolding issue - new action defaults to list action

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.
3d530114523d9cd69fca11d4db16ab9f?d=identicon&s=25 tyler (Guest)
on 2006-04-16 06:52
I'm creating a photo blog with ror.  The front end has gone great, so
now I'm working on the back end, and was playing with scaffolding.

I generated these scaffolds:
ruby script/generate scaffold Photo admin/photo
ruby script/generate scaffold Camera admin/camera

Then, in my routes, I added this line:
map.connect '/admin', :controller=>"admin/photo", :action=> "get_info"

The scaffolds work fine for everything with the exception of creating a
new photo or new camera.  I can edit, destory, show and list.  However,
when I hit the new button the url changes correctly:

http://localhost:3000/admin/photo
changes to
http://localhost:3000/admin/photo/new

However, the page is displaying as if it were at the list controller.  I
haven't touched the controller.

If I make the url this:
http://localhost:3000/admin/photo/new/1

Then I get the form for a new photo.  However, when I try hit submit to
create one, the page goes back to the list view, however, a new photo
was not created.

Any ideas?

My routes file is as follows:

map.connect '', :controller => "photo", :action=> "index"
 map.connect ':controller/', :action=> "index"
map.connect ':controller/:photo', :action=> "index"
map.connect ':controller/:photo/addcomment', :action=> "addcomment"
map.connect '/admin', :controller=>"admin/photo", :action=> "index"

# 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'

Any ideas or suggestions?

Thanks in advance
-tyler
This topic is locked and can not be replied to.