Need help with routes

I will try to word this as simple as possible…

I made a scaffold called ‘cover’ then migrated the table.

Of course the index, show, edit, and new .html.erb files work correctly
when they are called BUT, when I created a new .html.erb called ‘home’ I
routed it as so:

map.connect ‘/covers/’, :controller=>‘covers’, :action=>‘home’

and added

def home
end

I get the error “Couldn’t find Cover with ID=home”

I want that page to show content of the scaffold but before I add more
to the controller I want to make the page route “url” work.

Is my route wrong? Do I need to add something to the controller?

I’m trying to keep the application in 1 folder and staying away from the
has_many code.

Hi, Aaron D.!

Looks like you use “http://localhost:3000/covers/home” query instead
of “http://localhost:3000/covers” for access to home action in covers
controller.
But it really stange, how you add a specific route…

try to use

map.resources :covers, :collection => { :home => :get }

then use home_covers_path

it should generate ‘/covers/home’

or, if you want only rename index action

map.home ‘covers’, :controller => ‘covers’, :action => ‘index’

then use home_path

it should generate ‘/covers’

you can find much more competent explanation in this screencast

Thanks for the information. I was going off of what the book “Head
First Rails” explains on routes.

Just to be clear… I’m assuming “script/generate home_covers_path” will
make my specific path correct? I don’t have much time to try it now but
I will tonight. I’ll also look at that railscast before posting anymore
questions about routes. Thanks a whole lot!