Problem with CRUD II

I have a link:
<%= link_to_remote “Edit”, {:url => edit_book_url(book)}, {:href =>
edit_book_url(book)} %>

It produce a tag: Edit

My ./config/routes.rb file is:
ActionController::Routing::Routes.draw do |map|
map.resources :books, :members => {:delete => :get}
map.connect ‘:controller/service.wsdl’, :action => ‘wsdl’
map.connect ‘:controller/:action/:id.:format’
map.connect ‘:controller/:action/:id’
end

In log I get:
ActionController::RoutingError (no route found to match “/books/1;edit”
with {:method=>:post})

What’s wrong? Should I add map.connect ‘:controller/:id;:action’?

PS.
I would not like to just solve the problem. I’d like to solve it in
correct way.

I’ve probably left my head… somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)

Hey,

how about:

link_to_remote “Edit”, {:url => edit_book_url(book), :method => :get},
{:href => edit_book_url(book)}

HTH,
Trevor

On 5/24/07, Maciej P. [email protected] wrote:

ActionController::Routing::Routes.draw do |map|
What’s wrong? Should I add map.connect ‘:controller/:id;:action’?

Trevor S.
http://somethinglearned.com

A bit off-topic, but…

map.resources :books, :members => {:delete => :get}
What is this? It seems wrong. The CRUD method is destroy. Are you
trying to “alias” destroy with delete? Does your custom delete method
do something different than destroy? In any case the syntax looks
wrong to me.

It should look more like:
map.resources :books, :member => { :delete => :delete }

Notice “:member” is singular and you should NOT be doing “:get” if you
are deleting, or modifying, the resource in any way.

On Thu, 24 May 2007 15:15:30 -0700, Trevor S. wrote:

Hey,

how about:

link_to_remote “Edit”, {:url => edit_book_url(book), :method => :get},
{:href => edit_book_url(book)}

HTH,
Trevor

Thats it. Thanks


I’ve probably left my head… somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)

On Thu, 24 May 2007 16:21:10 -0700, Robert W. wrote:

Notice “:member” is singular and you should NOT be doing “:get” if you
are deleting, or modifying, the resource in any way.

It a hack for browser which do not have JavaScript. It will contains
only
button “Do you really want to delete?” which send it (unfortunatly) by
POST.
User click on “Delete” --> Does he have JS support? —Yes—> Send
delete
| request and
No gets
destroy.rjs
|
> He is redirect to confirmation
page delete.rhtml which send
request by POST.

Regards

I’ve probably left my head… somewhere. Please wait untill I find it.
Homepage (pl_PL): http://uzytkownik.jogger.pl/
(GNU/)Linux User: #425935 (see http://counter.li.org/)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs