hi. in order to better understand restful routes, i started with simple
routes and named routes. before doing map.resources :users in my app, i
decide to simulate all the 7 possibilities in my routes,rb file:

  # map.resources :users

  map.users        'users',             :controller => "users", :action
=> 'index'
  map.users        'users/create',      :controller => "users", :action
=> 'create',  :method => :post
  map.new_user     'users/new',         :controller => "users", :action
=> 'new'
  map.edit_user    'users/:id/edit',    :controller => "users", :action
=> 'edit'
  map.user         'users/:id',         :controller => "users", :action
=> 'show'
  map.user         'users/:id',         :controller => "users", :action
=> 'update',  :method => :put
  map.user         'users/:id',         :controller => "users", :action
=> 'destroy', :method => :delete

my index.html.erb file has the following code to create the links for
show, edit and delete:

    <td><%= link_to "show",     user %></td>
    <td><%= link_to "edit",     edit_user_path(user) %></td>
    <td><%= link_to 'delete',   user,
                                :confirm => 'Confirm delete?',
                                :method => :delete %></td>

but when i click on the delete link and confirm the delete javascript
alert, the show action is triggered instead of the destroy.

any ideas where is my mistake?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to